ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilBlogPosting Class Reference

Class ilBlogPosting. More...

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

Public Member Functions

 getParentType ()
 Get parent type. More...
 
 setTitle ($a_title)
 Set title. More...
 
 getTitle ()
 Get title. More...
 
 setBlogId ($a_id)
 Set blog object id. More...
 
 getBlogId ()
 Get blog object id. More...
 
 setCreated (ilDateTime $a_date)
 Set creation date. More...
 
 getCreated ()
 Get creation date. More...
 
 setAuthor ($a_id)
 Set author user id. More...
 
 getAuthor ()
 Get author user id. More...
 
 setApproved ($a_status)
 Toggle approval status. More...
 
 isApproved ()
 Get approved status. More...
 
 setWithdrawn (ilDateTime $a_date)
 Set last withdrawal date. More...
 
 getWithdrawn ()
 Get last withdrawal date. More...
 
 create ($a_import=false)
 Create new blog posting. More...
 
 update ($a_validate=true, $a_no_history=false, $a_notify=true, $a_notify_action="update")
 Update blog posting. More...
 
 read ()
 Read blog posting. More...
 
 checkApproval ()
 
 delete ()
 Delete blog posting and all related data. More...
 
 unpublish ()
 Unpublish. More...
 
 setBlogNodeId ($a_id, $a_is_in_workspace=false)
 Set blog node id (needed for notification) More...
 
 getNotificationAbstract ()
 
 getMDSection ()
 
 updateKeywords (array $keywords)
 
 handleNews ($a_update=false)
 Handle news item. More...
 
- Public Member Functions inherited from ilPageObject
 __construct ($a_id=0, $a_old_nr=0, $a_lang="-")
 Constructor public. More...
 
 afterConstructor ()
 After constructor. More...
 
 getParentType ()
 Get parent type. More...
 
 initPageConfig ()
 Init page config. More...
 
 setLanguage ($a_val)
 Set language. More...
 
 getLanguage ()
 Get language. More...
 
 setConcreteLang ($a_val)
 
 getConcreteLang ()
 
 setPageConfig ($a_val)
 Set page config object. More...
 
 getPageConfig ()
 Get page config object. More...
 
 setRenderMd5 ($a_rendermd5)
 Set Render MD5. More...
 
 getRenderMd5 ()
 Get Render MD5. More...
 
 setRenderedContent ($a_renderedcontent)
 Set Rendered Content. More...
 
 getRenderedContent ()
 Get Rendered Content. More...
 
 setRenderedTime ($a_renderedtime)
 Set Rendered Time. More...
 
 getRenderedTime ()
 Get Rendered Time. More...
 
 setLastChange ($a_lastchange)
 Set Last Change. More...
 
 getLastChange ()
 Get Last Change. More...
 
 setLastChangeUser ($a_val)
 Set last change user. More...
 
 getLastChangeUser ()
 Get last change user. More...
 
 setShowActivationInfo ($a_val)
 Set show page activation info. More...
 
 getShowActivationInfo ()
 Get show page activation info. More...
 
 read ()
 Read page data. More...
 
 buildDom ($a_force=false)
 
 freeDom ()
 
 getDom ()
 Deprecated php4DomDocument. More...
 
 getDomDoc ()
 Get dom doc (php5 dom document) More...
 
 setId ($a_id)
 set id More...
 
 getId ()
 
 setParentId ($a_id)
 
 getParentId ()
 
 addUpdateListener (&$a_object, $a_method, $a_parameters="")
 
 callUpdateListeners ()
 
 setActive ($a_active)
 set activation More...
 
 getActive ($a_check_scheduled_activation=false)
 get activation More...
 
 setActivationStart ($a_activationstart)
 Set Activation Start. More...
 
 getActivationStart ()
 Get Activation Start. More...
 
 setActivationEnd ($a_activationend)
 Set Activation End. More...
 
 getActivationEnd ()
 Get Activation End. More...
 
 getContentObject ($a_hier_id, $a_pc_id="")
 Get a content object of the page. More...
 
 getContentObjectForPcId ($pcid)
 Get content object for pc id. More...
 
 getParentContentObjectForPcId ($pcid)
 Get parent content object for pc id. More...
 
getContentNode ($a_hier_id, $a_pc_id="")
 Get content node from dom. More...
 
 checkForTag ($a_content_tag, $a_hier_id, $a_pc_id="")
 Get content node from dom. More...
 
 lookforhier ($a_hier_id)
 
getNode ()
 
 setXMLContent ($a_xml, $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 ($a_xml)
 append xml content to page setXMLContent must be called before and the same encoding must be used More...
 
 getXMLContent ($a_incl_head=false)
 get xml content of page More...
 
 copyXmlContent ($a_clone_mobs=false)
 Copy content of page; replace page components with copies where necessary (e.g. More...
 
 handleCopiedContent ($a_dom, $a_self_ass=true, $a_clone_mobs=false)
 Handle copied content This function copies items, that must be copied, if page content is duplicated. More...
 
 newIIMCopies ($temp_dom)
 Replaces media objects in interactive images with copies of the interactive images. More...
 
 newMobCopies ($temp_dom)
 Replaces media objects with copies. More...
 
 newQuestionCopies (&$temp_dom)
 Replaces existing question content elements with new copies. More...
 
 removeQuestions (&$temp_dom)
 Remove questions from document. More...
 
 countPageContents ()
 Remove questions from document. More...
 
 getXMLFromDom ( $a_incl_head=false, $a_append_mobs=false, $a_append_bib=false, $a_append_str="", $a_omit_pageobject_tag=false, $style_id=0)
 get xml content of page from dom (use this, if any changes are made to the document) More...
 
 getLanguageVariablesXML ($style_id=0)
 Get language variables as XML. More...
 
 appendLangVarXML (&$xml, $var)
 
 getFirstParagraphText ()
 
 getParagraphForPCID ($pcid)
 
 setParagraphContent ($a_hier_id, $a_content)
 Set content of paragraph. More...
 
 setContainsIntLink ($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 ($a_val)
 Set import mode. More...
 
 getImportMode ()
 Get import mode. More...
 
 needsImportParsing ($a_parse="")
 
 setContainsQuestion ($a_val)
 Set contains question. More...
 
 getContainsQuestion ()
 Get contains question. More...
 
 collectMediaObjects ($a_inline_only=true)
 get all media objects, that are referenced and used within the page More...
 
 getInternalLinks ($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 ($a_mob_id, $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 ($a_pc_ids)
 Get hier ids for a set of pc ids. More...
 
 getHierIdForPcId ($pcid)
 
 getPCIdsForHierIds ($hier_ids)
 Get hier ids for a set of pc ids. More...
 
 getPCIdForHierId ($hier_id)
 
 addFileSizes ()
 add file sizes More...
 
 resolveIntLinks ($a_link_map=null)
 Resolves all internal link targets of the page, if targets are available (after import) More...
 
 resolveMediaAliases ($a_mapping, $a_reuse_existing_by_import=false)
 Resolve media aliases (after import) More...
 
 resolveIIMMediaAliases ($a_mapping)
 Resolve iim media aliases (in ilContObjParse) More...
 
 resolveFileItems ($a_mapping)
 Resolve file items (after import) More...
 
 resolveQuestionReferences ($a_mapping)
 Resolve all quesion references (after import) More...
 
 moveIntLinks ($a_from_to)
 Move internal links from one destination to another. More...
 
 handleImportRepositoryLink ($a_rep_import_id, $a_rep_type, $a_rep_ref_id)
 
 handleRepositoryLinksOnCopy ($a_mapping, $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 (4.4.0 alpha) called by: More...
 
 afterUpdate ()
 After update. More...
 
 update ($a_validate=true, $a_no_history=false)
 update complete page content in db (dom xml content is used) More...
 
 delete ()
 delete page object More...
 
 saveStyleUsage ($a_domdoc, $a_old_nr=0)
 Save all style class/template usages. More...
 
 deleteStyleUsages ($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 ($a_domdoc)
 save internal links of page More...
 
 create ()
 create new page (with current xml data) More...
 
 deleteContent ($a_hid, $a_update=true, $a_pcid="")
 delete content object with hierarchical id $a_hid More...
 
 deleteContents ($a_hids, $a_update=true, $a_self_ass=false)
 Delete multiple content objects. More...
 
 cutContents ($a_hids)
 Copy contents to clipboard and cut them from the page. More...
 
 copyContents ($a_hids)
 Copy contents to clipboard. More...
 
 pasteContents ($a_hier_id, $a_self_ass=false)
 Paste contents from pc clipboard. More...
 
 switchEnableMultiple ($a_hids, $a_update=true, $a_self_ass=false)
 (De-)activate elements More...
 
 deleteContentFromHierId ($a_hid, $a_update=true)
 delete content object with hierarchical id >= $a_hid More...
 
 deleteContentBeforeHierId ($a_hid, $a_update=true)
 delete content object with hierarchical id < $a_hid More...
 
 insertContent (&$a_cont_obj, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="", bool $remove_placeholder=true)
 insert a content node before/after a sibling or as first child of a parent More...
 
 insertContentNode (&$a_cont_node, $a_pos, $a_mode=IL_INSERT_AFTER, $a_pcid="")
 insert a content node before/after a sibling or as first child of a parent More...
 
 moveContentBefore ($a_source, $a_target, $a_spcid="", $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids) More...
 
 moveContentAfter ($a_source, $a_target, $a_spcid="", $a_tpcid="")
 move content object from position $a_source before position $a_target (both hierarchical content ids) More...
 
 bbCode2XML (&$a_content)
 transforms bbCode to corresponding xml More...
 
 insertInstIntoIDs ($a_inst, $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 ()
 Get all pc ids. More...
 
 getDuplicatePCIds ()
 Get all duplicate PC Ids. More...
 
 existsPCId ($a_pc_id)
 existsPCId More...
 
 generatePcId ($a_pc_ids=false)
 Generate new pc id. More...
 
 insertPCIds ()
 Insert Page Content IDs. More...
 
 getPageContentsHashes ()
 Get page contents hashes. More...
 
 getQuestionIds ()
 Get question ids. More...
 
 send_paragraph ($par_id, $filename)
 
 getFO ()
 get fo page content More...
 
 registerOfflineHandler ($handler)
 
 getOfflineHandler ()
 Get offline handler. More...
 
 containsDeactivatedElements ($a_content)
 Check whether content contains deactivated elements. More...
 
 getHistoryEntries ()
 Get History Entries. More...
 
 getHistoryEntry ($a_old_nr)
 Get History Entry. More...
 
 getHistoryInfo ($a_nr)
 Get information about a history entry, its predecessor and its successor. More...
 
 addChangeDivClasses ($a_hashes)
 
 compareVersion ($a_left, $a_right)
 Compares to revisions of the page. More...
 
 increaseViewCnt ()
 Increase view cnt. More...
 
 writeRenderedContent ($a_content, $a_md5)
 Write rendered content. More...
 
 containsIntLinks ($a_content)
 Check whether content contains internal links. More...
 
 performAutomaticModifications ()
 Perform automatic modifications (may be overwritten by sub classes) More...
 
 saveInitialOpenedContent ($a_type, $a_id, $a_target)
 Save initial opened content. More...
 
 getInitialOpenedContent ()
 Get initial opened content. More...
 
 beforePageContentUpdate ($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 ($a_id, $a_parent_type="", $a_parent_id=0, $a_clone_mobs=false)
 Copy page. More...
 
 copyPageToTranslation ($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 ($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 ($targets, $char_par, $char_sec, $char_med)
 Assign characteristic. More...
 

Static Public Member Functions

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

Static Protected Member Functions

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

Protected Attributes

 $title
 
 $created
 
 $blog_node_id
 
 $blog_node_is_wsp
 
 $author
 
 $approved
 
 $withdrawn
 
- Protected Attributes inherited from ilPageObject
 $obj_definition
 
 $db
 
 $user
 
 $lng
 
 $tree
 
 $id
 
 $language = "-"
 
 $import_mode = false
 
 $log
 
 $page_record = array()
 
 $active = false
 
 $page_config
 
 $concrete_lang
 

Additional Inherited Members

- Data Fields inherited from ilPageObject
 $dom
 
 $xml
 
 $encoding
 
 $node
 
 $cur_dtd = "ilias_pg_5_4.dtd"
 
 $contains_int_link
 
 $needs_parsing
 
 $parent_type
 
 $parent_id
 
 $update_listeners
 
 $update_listener_cnt
 
 $offline_handler
 
 $dom_builded
 
 $history_saved
 
- Static Public Attributes inherited from ilPageObject
static $exists = array()
 
- Protected Member Functions inherited from ilPageObject
 __afterUpdate ($a_domdoc, $a_xml, $a_creation=false, $a_empty=false)
 After update event handler (internal). More...
 
 __beforeDelete ()
 Before deletion handler (internal). More...
 
 __afterHistoryEntry ($a_old_domdoc, $a_old_content, $a_old_nr)
 Before deletion handler (internal). More...
 
- Static Protected Attributes inherited from ilPageObject
static $activation_data = array()
 

Detailed Description

Member Function Documentation

◆ checkApproval()

ilBlogPosting::checkApproval ( )

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

References ilPageObject\getActive(), isApproved(), and update().

244  {
245  if (!$this->getActive() && $this->isApproved()) {
246  $this->approved = false;
247  $this->update();
248  }
249  }
isApproved()
Get approved status.
getActive($a_check_scheduled_activation=false)
get activation
update($a_validate=true, $a_no_history=false, $a_notify=true, $a_notify_action="update")
Update blog posting.
+ Here is the call graph for this function:

◆ create()

ilBlogPosting::create (   $a_import = false)

Create new blog posting.

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

References $created, ilPageObject\$db, ilPageObject\$id, $ilDB, $query, getAuthor(), getBlogId(), getCreated(), ilPageObject\getId(), getTitle(), getWithdrawn(), IL_CAL_DATETIME, isApproved(), ilUtil\now(), and ilPageObject\setId().

153  {
154  $ilDB = $this->db;
155 
156  $id = $ilDB->nextId("il_blog_posting");
157  $this->setId($id);
158 
159  if (!$a_import) {
160  $created = ilUtil::now();
161  } else {
162  $created = $this->getCreated()->get(IL_CAL_DATETIME);
163  }
164 
165  // we are using a separate creation date to enable sorting without JOINs
166 
167  $query = "INSERT INTO il_blog_posting (id, title, blog_id, created, author, approved, last_withdrawn)" .
168  " VALUES (" .
169  $ilDB->quote($this->getId(), "integer") . "," .
170  $ilDB->quote($this->getTitle(), "text") . "," .
171  $ilDB->quote($this->getBlogId(), "integer") . "," .
172  $ilDB->quote($created, "timestamp") . "," .
173  $ilDB->quote($this->getAuthor(), "integer") . "," .
174  $ilDB->quote($this->isApproved(), "integer") . "," . // #16526 - import
175  $ilDB->quote($this->getWithdrawn(), "timestamp") . ")";
176  $ilDB->manipulate($query);
177 
178  if (!$a_import) {
179  parent::create();
180  // $this->saveInternalLinks($this->getXMLContent());
181  }
182  }
getBlogId()
Get blog object id.
const IL_CAL_DATETIME
isApproved()
Get approved status.
getWithdrawn()
Get last withdrawal date.
static now()
Return current timestamp in Y-m-d H:i:s format.
getCreated()
Get creation date.
$query
setId($a_id)
set id
getAuthor()
Get author user id.
global $ilDB
getTitle()
Get title.
+ Here is the call graph for this function:

◆ delete()

ilBlogPosting::delete ( )

Delete blog posting and all related data.

Returns
bool

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

References ilPageObject\$db, $ilDB, $query, ilNewsItem\deleteNewsOfContext(), getBlogId(), ilPageObject\getId(), and getParentType().

257  {
258  $ilDB = $this->db;
259 
261  $this->getBlogId(),
262  "blog",
263  $this->getId(),
264  $this->getParentType()
265  );
266 
267  $query = "DELETE FROM il_blog_posting" .
268  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
269  $ilDB->manipulate($query);
270 
271  parent::delete();
272 
273  return true;
274  }
getBlogId()
Get blog object id.
$query
getParentType()
Get parent type.
static deleteNewsOfContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id=0, $a_context_sub_obj_type="")
Delete all news of a context.
global $ilDB
+ Here is the call graph for this function:

◆ deleteAllBlogPostings()

static ilBlogPosting::deleteAllBlogPostings (   $a_blog_id)
static

Delete all postings for blog.

Parameters
int$a_blog_id

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

References $DIC, ilPageObject\$id, $ilDB, and $query.

Referenced by ilObjBlog\doDelete().

301  {
302  global $DIC;
303 
304  $ilDB = $DIC->database();
305 
306  $query = "SELECT * FROM il_blog_posting" .
307  " WHERE blog_id = " . $ilDB->quote($a_blog_id, "integer");
308  $set = $ilDB->query($query);
309  while ($rec = $ilDB->fetchAssoc($set)) {
310  // delete all md keywords
311  $md_obj = new ilMD($a_blog_id, $rec["id"], "blp");
312  if (is_object($md_section = $md_obj->getGeneral())) {
313  foreach ($md_section->getKeywordIds() as $id) {
314  $md_key = $md_section->getKeyword($id);
315  $md_key->delete();
316  }
317  }
318 
319  $post = new ilBlogPosting($rec["id"]);
320  $post->delete();
321  }
322  }
Class ilBlogPosting.
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ exists()

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

Checks whether a posting exists.

Parameters
int$a_blog_id
int$a_posting_id
Returns
bool

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

References $DIC, $ilDB, and $query.

Referenced by ilObjBlogGUI\executeCommand().

398  {
399  global $DIC;
400 
401  $ilDB = $DIC->database();
402 
403  $query = "SELECT id FROM il_blog_posting" .
404  " WHERE blog_id = " . $ilDB->quote($a_blog_id, "integer") .
405  " AND id = " . $ilDB->quote($a_posting_id, "integer");
406  $set = $ilDB->query($query);
407  if ($rec = $ilDB->fetchAssoc($set)) {
408  return true;
409  }
410  return false;
411  }
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getAllPostings()

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

Get all postings of blog.

Parameters
int$a_blog_id
int$a_limit
int$a_offset
Returns
array

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

References $DIC, $ilDB, $query, and IL_CAL_DATETIME.

Referenced by ilObjBlogGUI\buildPostingList(), ilObjBlog\deliverRSS(), ILIAS\Blog\Export\BlogHtmlExport\exportHTMLPages(), ilBlogDraftsDerivedTaskProvider\getTasks(), ilBlogExporter\getXmlExportTailDependencies(), ilBlogPostingGUI\initKeywordsForm(), ilObjPortfolioGUI\initPDFSelectionForm(), ilPCBlogGUI\initPostingForm(), and ilObjPortfolioGUI\printView().

354  {
355  global $DIC;
356 
357  $ilDB = $DIC->database();
358 
359  $pages = parent::getAllPages("blp", $a_blog_id);
360 
361  if ($a_limit) {
362  $ilDB->setLimit($a_limit, $a_offset);
363  }
364 
365  $query = "SELECT * FROM il_blog_posting" .
366  " WHERE blog_id = " . $ilDB->quote($a_blog_id, "integer") .
367  " ORDER BY created DESC";
368  $set = $ilDB->query($query);
369  $post = array();
370  while ($rec = $ilDB->fetchAssoc($set)) {
371  if (isset($pages[$rec["id"]])) {
372  $post[$rec["id"]] = $pages[$rec["id"]];
373  $post[$rec["id"]]["title"] = $rec["title"];
374  $post[$rec["id"]]["created"] = new ilDateTime($rec["created"], IL_CAL_DATETIME);
375  $post[$rec["id"]]["author"] = $rec["author"];
376  $post[$rec["id"]]["approved"] = (bool) $rec["approved"];
377  $post[$rec["id"]]["last_withdrawn"] = new ilDateTime($rec["last_withdrawn"], IL_CAL_DATETIME);
378 
379  foreach (self::getPageContributors("blp", $rec["id"]) as $editor) {
380  if ($editor["user_id"] != $rec["author"]) {
381  $post[$rec["id"]]["editors"][] = $editor["user_id"];
382  }
383  }
384  }
385  }
386 
387  return $post;
388  }
const IL_CAL_DATETIME
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ getAuthor()

ilBlogPosting::getAuthor ( )

Get author user id.

Returns
int

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

References $author.

Referenced by create(), and handleNews().

107  {
108  return $this->author;
109  }
+ Here is the caller graph for this function:

◆ getBlogId()

ilBlogPosting::getBlogId ( )

Get blog object id.

Returns
int

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

References ilPageObject\getParentId().

Referenced by create(), delete(), getMDSection(), handleNews(), and unpublish().

67  {
68  return $this->getParentId();
69  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getCreated()

ilBlogPosting::getCreated ( )

Get creation date.

Returns
ilDateTime

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

References $created.

Referenced by create(), and update().

87  {
88  return $this->created;
89  }
+ Here is the caller graph for this function:

◆ getKeywords()

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

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

References ilMDKeyword\lookupKeywords().

Referenced by ilObjBlogGUI\filterItemsByKeyWord(), ilObjBlogGUI\getKeywords(), ilBlogPostingGUI\initKeywordsForm(), ilBlogDataSet\readData(), and ilObjBlogGUI\renderList().

504  {
505  return ilMDKeyword::lookupKeywords($a_obj_id, $a_posting_id);
506  }
static lookupKeywords($a_rbac_id, $a_obj_id, $a_return_ids=false)
Lookup Keywords.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getLastPost()

static ilBlogPosting::getLastPost (   $a_blog_id)
static

Get newest posting for blog.

Parameters
int$a_blog_id
Returns
int

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

References $data, and $keys.

420  {
421  $data = self::getAllPostings($a_blog_id, 1);
422  if ($data) {
423  $keys = array_keys($data);
424  return array_pop($keys);
425  }
426  }
$data
Definition: storeScorm.php:23
$keys
Definition: metadata.php:187

◆ getMDSection()

ilBlogPosting::getMDSection ( )

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

References getBlogId(), and ilPageObject\getId().

Referenced by updateKeywords().

481  {
482  // general section available?
483  $md_obj = new ilMD($this->getBlogId(), $this->getId(), "blp");
484  if (!is_object($md_section = $md_obj->getGeneral())) {
485  $md_section = $md_obj->addGeneral();
486  $md_section->save();
487  }
488 
489  return $md_section;
490  }
getBlogId()
Get blog object id.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getNotificationAbstract()

ilBlogPosting::getNotificationAbstract ( )

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

References ilPageObject\getId(), and ilBlogPostingGUI\getSnippet().

465  {
466  $snippet = ilBlogPostingGUI::getSnippet($this->getId(), true);
467 
468  // making things more readable
469  $snippet = str_replace('<br/>', "\n", $snippet);
470  $snippet = str_replace('<br />', "\n", $snippet);
471  $snippet = str_replace('</p>', "\n", $snippet);
472  $snippet = str_replace('</div>', "\n", $snippet);
473 
474  return trim(strip_tags($snippet));
475  }
static getSnippet($a_id, $a_truncate=false, $a_truncate_length=500, $a_truncate_sign="...", $a_include_picture=false, $a_picture_width=144, $a_picture_height=144, $a_export_directory=null)
Get first text paragraph of page.
+ Here is the call graph for this function:

◆ getParentType()

ilBlogPosting::getParentType ( )

Get parent type.

Returns
string parent type

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

Referenced by delete(), handleNews(), and unpublish().

26  {
27  return "blp";
28  }
+ Here is the caller graph for this function:

◆ getTitle()

ilBlogPosting::getTitle ( )

Get title.

Returns
string

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

References $title.

Referenced by create(), handleNews(), and update().

47  {
48  return $this->title;
49  }
+ Here is the caller graph for this function:

◆ getWithdrawn()

ilBlogPosting::getWithdrawn ( )

Get last withdrawal date.

Returns
ilDateTime

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

References $withdrawn.

Referenced by create(), and update().

145  {
146  return $this->withdrawn;
147  }
+ Here is the caller graph for this function:

◆ handleNews()

ilBlogPosting::handleNews (   $a_update = false)

Handle news item.

Parameters
bool$a_update

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

References $ilUser, ilPageObject\$lng, ilPageObject\$user, ilPageObject\getActive(), getAuthor(), getBlogId(), ilPageObject\getId(), ilNewsItem\getLastNewsIdForContext(), ilUserUtil\getNamePresentation(), getParentType(), ilBlogPostingGUI\getSnippet(), getTitle(), and NEWS_NOTICE.

514  {
515  $lng = $this->lng;
517 
518  // see ilWikiPage::updateNews()
519 
520  if (!$this->getActive()) {
521  return;
522  }
523 
524  $news_item = null;
525 
526  // try to re-use existing news item
527  if ((bool) $a_update) {
528  // get last news item of the day (if existing)
530  $this->getBlogId(),
531  "blog",
532  $this->getId(),
533  $this->getParentType(),
534  true
535  );
536  if ($news_id > 0) {
537  $news_item = new ilNewsItem($news_id);
538  }
539  }
540 
541  // create new news item
542  if (!$news_item) {
543  $news_set = new ilSetting("news");
544  $default_visibility = $news_set->get("default_visibility", "users");
545 
546  $news_item = new ilNewsItem();
547  $news_item->setContext(
548  $this->getBlogId(),
549  "blog",
550  $this->getId(),
551  $this->getParentType()
552  );
553  $news_item->setPriority(NEWS_NOTICE);
554  $news_item->setVisibility($default_visibility);
555  }
556 
557  // news author
558  $news_item->setUserId($ilUser->getId());
559 
560 
561  // news title/content
562 
563  $news_item->setTitle($this->getTitle());
564 
565  $content = $a_update
566  ? "blog_news_posting_updated"
567  : "blog_news_posting_published";
568 
569  // news "author"
570  $content = sprintf($lng->txt($content), ilUserUtil::getNamePresentation($ilUser->getId()));
571 
572  // posting author[s]
573  $contributors = array();
574  foreach (self::getPageContributors($this->getParentType(), $this->getId()) as $user) {
575  $contributors[] = $user["user_id"];
576  }
577  if (sizeof($contributors) > 1 || !in_array($this->getAuthor(), $contributors)) {
578  // original author should come first?
579  $authors = array(ilUserUtil::getNamePresentation($this->getAuthor()));
580  foreach ($contributors as $user_id) {
581  if ($user_id != $this->getAuthor()) {
582  $authors[] = ilUserUtil::getNamePresentation($user_id);
583  }
584  }
585  $content .= "\n" . sprintf($lng->txt("blog_news_posting_authors"), implode(", ", $authors));
586  }
587 
588  $news_item->setContentTextIsLangVar(false);
589  $news_item->setContent($content);
590 
591  $snippet = ilBlogPostingGUI::getSnippet($this->getId());
592  $news_item->setContentLong($snippet);
593 
594  if (!$news_item->getId()) {
595  $news_item->create();
596  } else {
597  $news_item->update(true);
598  }
599  }
getBlogId()
Get blog object id.
static getLastNewsIdForContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id="", $a_context_sub_obj_type="", $a_only_today=false)
Get last news id of news set related to a certain context.
getActive($a_check_scheduled_activation=false)
get activation
static getSnippet($a_id, $a_truncate=false, $a_truncate_length=500, $a_truncate_sign="...", $a_include_picture=false, $a_picture_width=144, $a_picture_height=144, $a_export_directory=null)
Get first text paragraph of page.
const NEWS_NOTICE
static getNamePresentation( $a_user_id, $a_user_image=false, $a_profile_link=false, $a_profile_back_link="", $a_force_first_lastname=false, $a_omit_login=false, $a_sortable=true, $a_return_data_array=false, $a_ctrl_path="ilpublicuserprofilegui")
Default behaviour is:
getAuthor()
Get author user id.
getParentType()
Get parent type.
getTitle()
Get title.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ isApproved()

ilBlogPosting::isApproved ( )

Get approved status.

Returns
bool

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

References $approved.

Referenced by checkApproval(), create(), and update().

125  {
126  return (bool) $this->approved;
127  }
+ Here is the caller graph for this function:

◆ lookup()

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

Lookup posting property.

Parameters
string$a_fieldfield
int$a_posting_idposting id
Returns
mixed

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

References ilPageObject\$db, and $DIC.

609  {
610  global $DIC;
611 
612  $db = $DIC->database();
613 
614  $set = $db->query("SELECT $a_field FROM il_blog_posting " .
615  " WHERE id = " . $db->quote($a_posting_id, "integer"));
616  $rec = $db->fetchAssoc($set);
617 
618  return $rec[$a_field];
619  }
global $DIC
Definition: goto.php:24

◆ lookupBlogId()

static ilBlogPosting::lookupBlogId (   $a_posting_id)
static

Lookup blog id.

Parameters
int$a_posting_id
Returns
int

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

References $DIC, $ilDB, and $query.

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

331  {
332  global $DIC;
333 
334  $ilDB = $DIC->database();
335 
336  $query = "SELECT blog_id FROM il_blog_posting" .
337  " WHERE id = " . $ilDB->quote($a_posting_id, "integer");
338  $set = $ilDB->query($query);
339  if ($rec = $ilDB->fetchAssoc($set)) {
340  return $rec["blog_id"];
341  }
342  return false;
343  }
global $DIC
Definition: goto.php:24
$query
global $ilDB
+ Here is the caller graph for this function:

◆ lookupTitle()

static ilBlogPosting::lookupTitle (   $a_posting_id)
static

Lookup title.

Parameters
int$a_posting_idposting id
Returns
string

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

628  {
629  $t = self::lookup("title", $a_posting_id);
630  return $t;
631  }

◆ read()

ilBlogPosting::read ( )

Read blog posting.

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

References ilPageObject\$db, $ilDB, $query, ilPageObject\addUpdateListener(), ilPageObject\getId(), IL_CAL_DATETIME, setApproved(), setAuthor(), setBlogId(), setCreated(), setTitle(), and setWithdrawn().

220  {
221  $ilDB = $this->db;
222 
223  $query = "SELECT * FROM il_blog_posting" .
224  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
225  $set = $ilDB->query($query);
226  $rec = $ilDB->fetchAssoc($set);
227 
228  $this->setTitle($rec["title"]);
229  $this->setBlogId($rec["blog_id"]);
230  $this->setCreated(new ilDateTime($rec["created"], IL_CAL_DATETIME));
231  $this->setAuthor($rec["author"]);
232  if ((bool) $rec["approved"]) {
233  $this->setApproved(true);
234  }
235  $this->setWithdrawn(new ilDateTime($rec["last_withdrawn"], IL_CAL_DATETIME));
236 
237  // when posting is deactivated it should loose the approval
238  $this->addUpdateListener($this, "checkApproval");
239 
240  parent::read();
241  }
const IL_CAL_DATETIME
setCreated(ilDateTime $a_date)
Set creation date.
setAuthor($a_id)
Set author user id.
setApproved($a_status)
Toggle approval status.
addUpdateListener(&$a_object, $a_method, $a_parameters="")
$query
setWithdrawn(ilDateTime $a_date)
Set last withdrawal date.
global $ilDB
setTitle($a_title)
Set title.
setBlogId($a_id)
Set blog object id.
+ Here is the call graph for this function:

◆ searchBlogsByAuthor()

static ilBlogPosting::searchBlogsByAuthor (   $a_user_id)
static

Get all blogs where user has postings.

Parameters
int$a_user_id
Returns
array

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

References $DIC, and $ilDB.

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

447  {
448  global $DIC;
449 
450  $ilDB = $DIC->database();
451 
452  $ids = array();
453 
454  $sql = "SELECT DISTINCT(blog_id)" .
455  " FROM il_blog_posting" .
456  " WHERE author = " . $ilDB->quote($a_user_id);
457  $set = $ilDB->query($sql);
458  while ($row = $ilDB->fetchAssoc($set)) {
459  $ids[] = $row["blog_id"];
460  }
461  return $ids;
462  }
global $DIC
Definition: goto.php:24
global $ilDB
+ Here is the caller graph for this function:

◆ setApproved()

ilBlogPosting::setApproved (   $a_status)

Toggle approval status.

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

Referenced by read(), and unpublish().

115  {
116  $this->approved = (bool) $a_status;
117  }
+ Here is the caller graph for this function:

◆ setAuthor()

ilBlogPosting::setAuthor (   $a_id)

Set author user id.

Parameters
int$a_id

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

Referenced by read().

97  {
98  $this->author = (int) $a_id;
99  }
+ Here is the caller graph for this function:

◆ setBlogId()

ilBlogPosting::setBlogId (   $a_id)

Set blog object id.

Parameters
int$a_id

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

References ilPageObject\setParentId().

Referenced by read().

57  {
58  $this->setParentId($a_id);
59  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setBlogNodeId()

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

Set blog node id (needed for notification)

Parameters
int$a_id
bool$a_is_in_workspace

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

435  {
436  $this->blog_node_id = (int) $a_id;
437  $this->blog_node_is_wsp = (bool) $a_is_in_workspace;
438  }

◆ setCreated()

ilBlogPosting::setCreated ( ilDateTime  $a_date)

Set creation date.

Parameters
ilDateTime$a_date

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

Referenced by read().

77  {
78  $this->created = $a_date;
79  }
+ Here is the caller graph for this function:

◆ setTitle()

ilBlogPosting::setTitle (   $a_title)

Set title.

Parameters
string$a_title

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

Referenced by read().

37  {
38  $this->title = $a_title;
39  }
+ Here is the caller graph for this function:

◆ setWithdrawn()

ilBlogPosting::setWithdrawn ( ilDateTime  $a_date)

Set last withdrawal date.

Parameters
ilDateTime$a_date

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

Referenced by read(), and unpublish().

135  {
136  $this->withdrawn = $a_date;
137  }
+ Here is the caller graph for this function:

◆ unpublish()

ilBlogPosting::unpublish ( )

Unpublish.

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

References ilNewsItem\deleteNewsOfContext(), getBlogId(), ilPageObject\getId(), getParentType(), IL_CAL_DATETIME, ilUtil\now(), ilPageObject\setActive(), setApproved(), setWithdrawn(), and update().

280  {
281  $this->setApproved(false);
282  $this->setActive(false);
284  $this->update(true, false, false);
285 
287  $this->getBlogId(),
288  "blog",
289  $this->getId(),
290  $this->getParentType()
291  );
292  }
getBlogId()
Get blog object id.
const IL_CAL_DATETIME
setActive($a_active)
set activation
static now()
Return current timestamp in Y-m-d H:i:s format.
setApproved($a_status)
Toggle approval status.
getParentType()
Get parent type.
static deleteNewsOfContext( $a_context_obj_id, $a_context_obj_type, $a_context_sub_obj_id=0, $a_context_sub_obj_type="")
Delete all news of a context.
setWithdrawn(ilDateTime $a_date)
Set last withdrawal date.
update($a_validate=true, $a_no_history=false, $a_notify=true, $a_notify_action="update")
Update blog posting.
+ Here is the call graph for this function:

◆ update()

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

Update blog posting.

Parameters
bool$a_validate
bool$a_no_history
bool$a_notify
string$a_notify_action
Returns
boolean

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

References ilPageObject\$db, $ilDB, $query, ilPageObject\getActive(), getCreated(), ilPageObject\getId(), getTitle(), getWithdrawn(), IL_CAL_DATETIME, isApproved(), and ilObjBlog\sendNotification().

Referenced by checkApproval(), and unpublish().

194  {
195  $ilDB = $this->db;
196 
197  // blog_id, author and created cannot be changed
198 
199  $query = "UPDATE il_blog_posting SET" .
200  " title = " . $ilDB->quote($this->getTitle(), "text") .
201  ",created = " . $ilDB->quote($this->getCreated()->get(IL_CAL_DATETIME), "timestamp") .
202  ",approved =" . $ilDB->quote($this->isApproved(), "integer") .
203  ",last_withdrawn =" . $ilDB->quote($this->getWithdrawn()->get(IL_CAL_DATETIME), "timestamp") .
204  " WHERE id = " . $ilDB->quote($this->getId(), "integer");
205  $ilDB->manipulate($query);
206 
207  parent::update($a_validate, $a_no_history);
208 
209  if ($a_notify && $this->getActive()) {
210  ilObjBlog::sendNotification($a_notify_action, $this->blog_node_is_wsp, $this->blog_node_id, $this->getId());
211  }
212 
213  return true;
214  }
const IL_CAL_DATETIME
isApproved()
Get approved status.
getWithdrawn()
Get last withdrawal date.
getActive($a_check_scheduled_activation=false)
get activation
getCreated()
Get creation date.
$query
global $ilDB
getTitle()
Get title.
static sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ updateKeywords()

ilBlogPosting::updateKeywords ( array  $keywords)

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

References $ilUser, ilPageObject\$user, getMDSection(), and ilMDKeyword\updateKeywords().

493  {
495 
496  // language is not "used" anywhere
497  $ulang = $ilUser->getLanguage();
498  $keywords = array($ulang => $keywords);
499 
500  ilMDKeyword::updateKeywords($this->getMDSection(), $keywords);
501  }
static updateKeywords(ilMDGeneral $a_md_section, array $a_keywords)
Update keywords from input array.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

Field Documentation

◆ $approved

ilBlogPosting::$approved
protected

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

Referenced by isApproved().

◆ $author

ilBlogPosting::$author
protected

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

Referenced by getAuthor().

◆ $blog_node_id

ilBlogPosting::$blog_node_id
protected

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

◆ $blog_node_is_wsp

ilBlogPosting::$blog_node_is_wsp
protected

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

◆ $created

ilBlogPosting::$created
protected

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

Referenced by create(), and getCreated().

◆ $title

ilBlogPosting::$title
protected

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

Referenced by getTitle().

◆ $withdrawn

ilBlogPosting::$withdrawn
protected

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

Referenced by getWithdrawn().


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