ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
class.ilObjBlog.php
Go to the documentation of this file.
1 <?php
2 
3 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
4 
5 require_once "Services/Object/classes/class.ilObject2.php";
6 
15 class ilObjBlog extends ilObject2
16 {
17 
21  public function __construct($a_id = 0, $a_reference = true)
22  {
23  global $DIC;
24 
25  parent::__construct($a_id, $a_reference);
26  $this->rbacreview = $DIC->rbac()->review();
27  }
28 
29  protected $notes; // [bool]
30  protected $bg_color; // [string]
31  protected $font_color; // [string]
32  protected $img; // [string]
33  protected $ppic; // [string]
34  protected $rss; // [bool]
35  protected $approval; // [bool]
36  protected $style; // [bool]
37  protected $abstract_shorten = false; // [bool]
38  protected $abstract_shorten_length = self::ABSTRACT_DEFAULT_SHORTEN_LENGTH; // [int]
39  protected $abstract_image = false; // [bool]
40  protected $abstract_image_width = self::ABSTRACT_DEFAULT_IMAGE_WIDTH; // [int]
41  protected $abstract_image_height = self::ABSTRACT_DEFAULT_IMAGE_HEIGHT; // [int]
42  protected $keywords = true; // [bool]
43  protected $nav_mode = self::NAV_MODE_LIST; // [int]
44  protected $nav_mode_list_postings = self::NAV_MODE_LIST_DEFAULT_POSTINGS; // [int]
45  protected $nav_mode_list_months; // [int]
46  protected $overview_postings; // [int]
47  protected $authors = true; // [bool]
48  protected $order;
49 
50  const NAV_MODE_LIST = 1;
51  const NAV_MODE_MONTH = 2;
52 
57 
58  public function initType()
59  {
60  $this->type = "blog";
61  }
62 
63  protected function doRead()
64  {
65  $ilDB = $this->db;
66 
67  $set = $ilDB->query("SELECT * FROM il_blog" .
68  " WHERE id = " . $ilDB->quote($this->id, "integer"));
69  $row = $ilDB->fetchAssoc($set);
70  $this->setProfilePicture((bool) $row["ppic"]);
71  $this->setBackgroundColor($row["bg_color"]);
72  $this->setFontColor($row["font_color"]);
73  $this->setImage($row["img"]);
74  $this->setRSS($row["rss_active"]);
75  $this->setApproval($row["approval"]);
76  $this->setAbstractShorten($row["abs_shorten"]);
77  $this->setAbstractShortenLength($row["abs_shorten_len"]);
78  $this->setAbstractImage($row["abs_image"]);
79  $this->setAbstractImageWidth($row["abs_img_width"]);
80  $this->setAbstractImageHeight($row["abs_img_height"]);
81  $this->setKeywords($row["keywords"]);
82  $this->setAuthors($row["authors"]);
83  $this->setNavMode($row["nav_mode"]);
84  $this->setNavModeListMonthsWithPostings($row["nav_list_mon_with_post"]);
85  $this->setNavModeListMonths($row["nav_list_mon"]);
86  $this->setOverviewPostings($row["ov_post"]);
87  if (trim($row["nav_order"])) {
88  $this->setOrder(explode(";", $row["nav_order"]));
89  }
90 
91  // #14661
92  include_once("./Services/Notes/classes/class.ilNote.php");
93  $this->setNotesStatus(ilNote::commentsActivated($this->id, 0, "blog"));
94 
95  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
97  }
98 
99  protected function doCreate()
100  {
101  $ilDB = $this->db;
102 
103  $ilDB->manipulate("INSERT INTO il_blog (id,ppic,rss_active,approval" .
104  ",abs_shorten,abs_shorten_len,abs_image,abs_img_width,abs_img_height" .
105  ",keywords,authors,nav_mode,nav_list_mon_with_post) VALUES (" .
106  $ilDB->quote($this->id, "integer") . "," .
107  $ilDB->quote(true, "integer") . "," .
108  $ilDB->quote(true, "integer") . "," .
109  $ilDB->quote(false, "integer") . "," .
110  $ilDB->quote($this->hasAbstractShorten(), "integer") . "," .
111  $ilDB->quote($this->getAbstractShortenLength(), "integer") . "," .
112  $ilDB->quote($this->hasAbstractImage(), "integer") . "," .
113  $ilDB->quote($this->getAbstractImageWidth(), "integer") . "," .
114  $ilDB->quote($this->getAbstractImageHeight(), "integer") . "," .
115  $ilDB->quote($this->hasKeywords(), "integer") . "," .
116  $ilDB->quote($this->hasAuthors(), "integer") . "," .
117  $ilDB->quote($this->getNavMode(), "integer") . "," .
118  $ilDB->quote($this->getNavModeListMonthsWithPostings(), "integer") .
119  ")");
120 
121  // #14661
122  include_once("./Services/Notes/classes/class.ilNote.php");
123  ilNote::activateComments($this->id, 0, "blog", true);
124 
125  /*
126  if ($this->getStyleSheetId() > 0)
127  {
128  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
129  ilObjStyleSheet::writeStyleUsage($this->id, $this->getStyleSheetId());
130  }
131  */
132  }
133 
134  protected function doDelete()
135  {
136  $ilDB = $this->db;
137 
138  $this->deleteImage();
139 
140  include_once "Modules/Blog/classes/class.ilBlogPosting.php";
142 
143  // remove all notifications
144  include_once "./Services/Notification/classes/class.ilNotification.php";
146 
147  $ilDB->manipulate("DELETE FROM il_blog" .
148  " WHERE id = " . $ilDB->quote($this->id, "integer"));
149  }
150 
151  protected function doUpdate()
152  {
153  $ilDB = $this->db;
154 
155  if ($this->id) {
156  $ilDB->manipulate("UPDATE il_blog" .
157  " SET ppic = " . $ilDB->quote($this->hasProfilePicture(), "integer") .
158  ",bg_color = " . $ilDB->quote($this->getBackgroundColor(), "text") .
159  ",font_color = " . $ilDB->quote($this->getFontcolor(), "text") .
160  ",img = " . $ilDB->quote($this->getImage(), "text") .
161  ",rss_active = " . $ilDB->quote($this->hasRSS(), "integer") .
162  ",approval = " . $ilDB->quote($this->hasApproval(), "integer") .
163  ",abs_shorten = " . $ilDB->quote($this->hasAbstractShorten(), "integer") .
164  ",abs_shorten_len = " . $ilDB->quote($this->getAbstractShortenLength(), "integer") .
165  ",abs_image = " . $ilDB->quote($this->hasAbstractImage(), "integer") .
166  ",abs_img_width = " . $ilDB->quote($this->getAbstractImageWidth(), "integer") .
167  ",abs_img_height = " . $ilDB->quote($this->getAbstractImageHeight(), "integer") .
168  ",keywords = " . $ilDB->quote($this->hasKeywords(), "integer") .
169  ",authors = " . $ilDB->quote($this->hasAuthors(), "integer") .
170  ",nav_mode = " . $ilDB->quote($this->getNavMode(), "integer") .
171  ",nav_list_mon_with_post = " . $ilDB->quote($this->getNavModeListMonthsWithPostings(), "integer") .
172  ",nav_list_mon = " . $ilDB->quote($this->getNavModeListMonths(), "integer") .
173  ",ov_post = " . $ilDB->quote($this->getOverviewPostings(), "integer") .
174  ",nav_order = " . $ilDB->quote(implode(";", $this->getOrder()), "text") .
175  " WHERE id = " . $ilDB->quote($this->id, "integer"));
176 
177  // #14661
178  include_once("./Services/Notes/classes/class.ilNote.php");
179  ilNote::activateComments($this->id, 0, "blog", $this->getNotesStatus());
180 
181  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
183  }
184  }
185 
186  protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = null, $a_omit_tree = false)
187  {
188  // banner?
189  $img = $this->getImage();
190  if ($img) {
191  $new_obj->setImage($img);
192 
193  $source = $this->initStorage($this->getId());
194  $target = $new_obj->initStorage($new_obj->getId());
195 
196  copy($source . $img, $target . $img);
197  }
198 
199  $new_obj->setNotesStatus($this->getNotesStatus());
200  $new_obj->setProfilePicture($this->hasProfilePicture());
201  $new_obj->setBackgroundColor($this->getBackgroundColor());
202  $new_obj->setFontColor($this->getFontColor());
203  $new_obj->setRSS($this->hasRSS());
204  $new_obj->setApproval($this->hasApproval());
205  $new_obj->setAbstractShorten($this->hasAbstractShorten());
206  $new_obj->setAbstractShortenLength($this->getAbstractShortenLength());
207  $new_obj->setAbstractImage($this->hasAbstractImage());
208  $new_obj->setAbstractImageWidth($this->getAbstractImageWidth());
209  $new_obj->setAbstractImageHeight($this->getAbstractImageHeight());
210  $new_obj->update();
211 
212  // set/copy stylesheet
213  include_once("./Services/Style/Content/classes/class.ilObjStyleSheet.php");
214  $style_id = $this->getStyleSheetId();
215  if ($style_id > 0 && !ilObjStyleSheet::_lookupStandard($style_id)) {
216  $style_obj = ilObjectFactory::getInstanceByObjId($style_id);
217  $new_id = $style_obj->ilClone();
218  $new_obj->setStyleSheetId($new_id);
219  $new_obj->update();
220  }
221  }
222 
228  public function getNotesStatus()
229  {
230  return $this->notes;
231  }
232 
238  public function setNotesStatus($a_status)
239  {
240  $this->notes = (bool) $a_status;
241  }
242 
248  public function hasProfilePicture()
249  {
250  return $this->ppic;
251  }
252 
258  public function setProfilePicture($a_status)
259  {
260  $this->ppic = (bool) $a_status;
261  }
262 
268  public function getBackgroundColor()
269  {
270  if (!$this->bg_color) {
271  $this->bg_color = "ffffff";
272  }
273  return $this->bg_color;
274  }
275 
281  public function setBackgroundColor($a_value)
282  {
283  $this->bg_color = (string) $a_value;
284  }
285 
291  public function getFontColor()
292  {
293  if (!$this->font_color) {
294  $this->font_color = "505050";
295  }
296  return $this->font_color;
297  }
298 
304  public function setFontColor($a_value)
305  {
306  $this->font_color = (string) $a_value;
307  }
308 
314  public function getImage()
315  {
316  return $this->img;
317  }
318 
324  public function setImage($a_value)
325  {
326  $this->img = (string) $a_value;
327  }
328 
334  public function getImageFullPath($a_as_thumb = false)
335  {
336  if ($this->img) {
337  $path = $this->initStorage($this->id);
338  if (!$a_as_thumb) {
339  return $path . $this->img;
340  } else {
341  return $path . "thb_" . $this->img;
342  }
343  }
344  }
345 
349  public function deleteImage()
350  {
351  if ($this->id) {
352  include_once "Modules/Blog/classes/class.ilFSStorageBlog.php";
353  $storage = new ilFSStorageBlog($this->id);
354  $storage->delete();
355 
356  $this->setImage(null);
357 
358  $this->handleQuotaUpdate();
359  }
360  }
361 
369  public static function initStorage($a_id, $a_subdir = null)
370  {
371  include_once "Modules/Blog/classes/class.ilFSStorageBlog.php";
372  $storage = new ilFSStorageBlog($a_id);
373  $storage->create();
374 
375  $path = $storage->getAbsolutePath() . "/";
376 
377  if ($a_subdir) {
378  $path .= $a_subdir . "/";
379 
380  if (!is_dir($path)) {
381  mkdir($path);
382  }
383  }
384 
385  return $path;
386  }
387 
394  public function uploadImage(array $a_upload)
395  {
396  if (!$this->id) {
397  return false;
398  }
399 
400  $this->deleteImage();
401 
402  // #10074
403  $clean_name = preg_replace("/[^a-zA-Z0-9\_\.\-]/", "", $a_upload["name"]);
404 
405  $path = $this->initStorage($this->id);
406  $original = "org_" . $this->id . "_" . $clean_name;
407  $thumb = "thb_" . $this->id . "_" . $clean_name;
408  $processed = $this->id . "_" . $clean_name;
409 
410  if (ilUtil::moveUploadedFile($a_upload["tmp_name"], $original, $path . $original)) {
411  chmod($path . $original, 0770);
412 
413  $blga_set = new ilSetting("blga");
414  /* as banner height should overflow, we only handle width
415  $dimensions = $blga_set->get("banner_width")."x".
416  $blga_set->get("banner_height");
417  */
418  $dimensions = $blga_set->get("banner_width");
419 
420  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
421  // taking only frame [0] to avoid problems with animated gifs
422  $original_file = ilUtil::escapeShellArg($path . $original);
423  $thumb_file = ilUtil::escapeShellArg($path . $thumb);
424  $processed_file = ilUtil::escapeShellArg($path . $processed);
425  ilUtil::execConvert($original_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
426  ilUtil::execConvert($original_file . "[0] -geometry " . $dimensions . " -quality 100 JPEG:" . $processed_file);
427 
428  $this->setImage($processed);
429 
430  $this->handleQuotaUpdate();
431 
432  return true;
433  }
434  return false;
435  }
436 
442  public function hasRSS()
443  {
444  return $this->rss;
445  }
446 
452  public function setRSS($a_status)
453  {
454  $this->rss = (bool) $a_status;
455  }
456 
462  public function hasApproval()
463  {
464  return (bool) $this->approval;
465  }
466 
472  public function setApproval($a_status)
473  {
474  $this->approval = (bool) $a_status;
475  }
476 
482  public function getStyleSheetId()
483  {
484  return (int) $this->style;
485  }
486 
492  public function setStyleSheetId($a_style)
493  {
494  $this->style = (int) $a_style;
495  }
496 
497  public function hasAbstractShorten()
498  {
500  }
501 
502  public function setAbstractShorten($a_value)
503  {
504  $this->abstract_shorten = (bool) $a_value;
505  }
506 
507  public function getAbstractShortenLength()
508  {
510  }
511 
512  public function setAbstractShortenLength($a_value)
513  {
514  $this->abstract_shorten_length = (int) $a_value;
515  }
516 
517  public function hasAbstractImage()
518  {
519  return $this->abstract_image;
520  }
521 
522  public function setAbstractImage($a_value)
523  {
524  $this->abstract_image = (bool) $a_value;
525  }
526 
527  public function getAbstractImageWidth()
528  {
530  }
531 
532  public function setAbstractImageWidth($a_value)
533  {
534  $this->abstract_image_width = (int) $a_value;
535  }
536 
537  public function getAbstractImageHeight()
538  {
540  }
541 
542  public function setAbstractImageHeight($a_value)
543  {
544  $this->abstract_image_height = (int) $a_value;
545  }
546 
547  public function setKeywords($a_value)
548  {
549  $this->keywords = (bool) $a_value;
550  }
551 
552  public function hasKeywords()
553  {
554  return $this->keywords;
555  }
556 
557  public function setAuthors($a_value)
558  {
559  $this->authors = (bool) $a_value;
560  }
561 
562  public function hasAuthors()
563  {
564  return $this->authors;
565  }
566 
567  public function setNavMode($a_value)
568  {
569  $a_value = (int) $a_value;
570  if (in_array($a_value, array(self::NAV_MODE_LIST, self::NAV_MODE_MONTH))) {
571  $this->nav_mode = $a_value;
572  }
573  }
574 
575  public function getNavMode()
576  {
577  return $this->nav_mode;
578  }
579 
580  public function setNavModeListMonthsWithPostings($a_value)
581  {
582  $this->nav_mode_list_months_with_post = (int) $a_value;
583  }
584 
586  {
587  return $this->nav_mode_list_months_with_post;
588  }
589 
590  public function setNavModeListMonths($a_value)
591  {
592  if (!$a_value) {
593  $a_value = null;
594  } else {
595  $a_value = (int) $a_value;
596  }
597  $this->nav_mode_list_months = $a_value;
598  }
599 
600  public function getNavModeListMonths()
601  {
603  }
604 
605  public function setOverviewPostings($a_value)
606  {
607  if (!$a_value) {
608  $a_value = null;
609  } else {
610  $a_value = (int) $a_value;
611  }
612  $this->overview_postings = $a_value;
613  }
614 
615  public function getOverviewPostings()
616  {
618  }
619 
620  public function setOrder(array $a_values = null)
621  {
622  $this->order = $a_values;
623  }
624 
625  public function getOrder()
626  {
627  return (array) $this->order;
628  }
629 
630  public static function sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment = null)
631  {
632  global $DIC;
633 
634  $ilUser = $DIC->user();
635 
636  // get blog object id (repository or workspace)
637  if ($a_in_wsp) {
638  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
639  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
640  $tree = new ilWorkspaceTree($ilUser->getId()); // owner of tree is irrelevant
641  $blog_obj_id = $tree->lookupObjectId($a_blog_node_id);
642  $access_handler = new ilWorkspaceAccessHandler($tree);
643  } else {
644  $blog_obj_id = ilObject::_lookupObjId($a_blog_node_id);
645  $access_handler = null;
646  }
647  if (!$blog_obj_id) {
648  return;
649  }
650 
651  include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
652  $posting = new ilBlogPosting($a_posting_id);
653 
654  // #11138
655  $ignore_threshold = ($a_action == "comment");
656 
657  $admin_only = false;
658 
659  // approval handling
660  if (!$posting->isApproved()) {
661  $blog = new self($blog_obj_id, false);
662  if ($blog->hasApproval()) {
663  switch ($a_action) {
664  case "update":
665  // un-approved posting was updated - no notifications
666  return;
667 
668  case "new":
669  // un-approved posting was activated - admin-only notification
670  $admin_only = true;
671  $ignore_threshold = true;
672  $a_action = "approve";
673  break;
674  }
675  }
676  }
677 
678  // create/update news item (only in repository)
679  if (!$a_in_wsp &&
680  in_array($a_action, array("update", "new"))) {
681  $posting->handleNews(($a_action == "update"));
682  }
683 
684  // recipients
685  include_once "./Services/Notification/classes/class.ilNotification.php";
688  $blog_obj_id,
689  $a_posting_id,
690  $ignore_threshold
691  );
692  if (!sizeof($users)) {
693  return;
694  }
695 
696  include_once "./Services/Notification/classes/class.ilSystemNotification.php";
697  $ntf = new ilSystemNotification($a_in_wsp);
698  $ntf->setLangModules(array("blog"));
699  $ntf->setRefId($a_blog_node_id);
700  $ntf->setChangedByUserId($ilUser->getId());
701  $ntf->setSubjectLangId('blog_change_notification_subject');
702  $ntf->setIntroductionLangId('blog_change_notification_body_' . $a_action);
703  $ntf->addAdditionalInfo('blog_posting', $posting->getTitle());
704  if ($a_comment) {
705  $ntf->addAdditionalInfo('comment', $a_comment, true);
706  }
707  $ntf->setGotoLangId('blog_change_notification_link');
708  $ntf->setReasonLangId('blog_change_notification_reason');
709 
710  $abstract = $posting->getNotificationAbstract();
711  if ($abstract) {
712  $ntf->addAdditionalInfo('content', $abstract, true);
713  }
714 
715  $notified = $ntf->sendMail(
716  $users,
717  "_" . $a_posting_id,
718  ($admin_only ? "write" : "read")
719  );
720 
721  // #14387
722  if (sizeof($notified)) {
723  ilNotification::updateNotificationTime(ilNotification::TYPE_BLOG, $blog_obj_id, $notified, $a_posting_id);
724  }
725  }
726 
732  public static function deliverRSS($a_wsp_id)
733  {
734  global $DIC;
735 
736  $tpl = $DIC["tpl"];
737  $ilSetting = $DIC->settings();
738 
739  if (!$ilSetting->get('enable_global_profiles')) {
740  return;
741  }
742 
743  // #10827
744  if (substr($a_wsp_id, -4) != "_cll") {
745  include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
746  $wsp_id = new ilWorkspaceTree(0);
747  $obj_id = $wsp_id->lookupObjectId($a_wsp_id);
748  $is_wsp = "_wsp";
749  } else {
750  $a_wsp_id = substr($a_wsp_id, 0, -4);
751  $obj_id = ilObject::_lookupObjId($a_wsp_id);
752  $is_wsp = null;
753  }
754  if (!$obj_id) {
755  return;
756  }
757 
758  $blog = new self($obj_id, false);
759  if (!$blog->hasRSS()) {
760  return;
761  }
762 
763  include_once "Services/Feeds/classes/class.ilFeedWriter.php";
764  $feed = new ilFeedWriter();
765 
766  include_once "Services/Link/classes/class.ilLink.php";
767  $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, $is_wsp);
768  $url = str_replace("&", "&amp;", $url);
769 
770  // #11870
771  $feed->setChannelTitle(str_replace("&", "&amp;", $blog->getTitle()));
772  $feed->setChannelDescription(str_replace("&", "&amp;", $blog->getDescription()));
773  $feed->setChannelLink($url);
774 
775  // needed for blogpostinggui / pagegui
776  $tpl = new ilTemplate("tpl.main.html", true, true);
777 
778  include_once("./Modules/Blog/classes/class.ilBlogPosting.php");
779  include_once("./Modules/Blog/classes/class.ilBlogPostingGUI.php");
780  foreach (ilBlogPosting::getAllPostings($obj_id) as $item) {
781  $id = $item["id"];
782 
783  // only published items
784  $is_active = ilBlogPosting::_lookupActive($id, "blp");
785  if (!$is_active) {
786  continue;
787  }
788 
789  // #16434
790  $snippet = strip_tags(ilBlogPostingGUI::getSnippet($id), "<br><br/><div><p>");
791  $snippet = str_replace("&", "&amp;", $snippet);
792  $snippet = "<![CDATA[" . $snippet . "]]>";
793 
794  $url = ilLink::_getStaticLink($a_wsp_id, "blog", true, "_" . $id . $is_wsp);
795  $url = str_replace("&", "&amp;", $url);
796 
797  $feed_item = new ilFeedItem();
798  $feed_item->setTitle(str_replace("&", "&amp;", $item["title"])); // #16022
799  $feed_item->setDate($item["created"]->get(IL_CAL_DATETIME));
800  $feed_item->setDescription($snippet);
801  $feed_item->setLink($url);
802  $feed_item->setAbout($url);
803  $feed->addItem($feed_item);
804  }
805 
806  $feed->showFeed();
807  exit();
808  }
809 
810  public function initDefaultRoles()
811  {
812  include_once './Services/AccessControl/classes/class.ilObjRole.php';
814  'il_blog_contributor_' . $this->getRefId(),
815  "Contributor of blog obj_no." . $this->getId(),
816  'il_blog_contributor',
817  $this->getRefId()
818  );
819 
820  include_once './Services/AccessControl/classes/class.ilObjRole.php';
822  'il_blog_editor_' . $this->getRefId(),
823  "Editor of blog obj_no." . $this->getId(),
824  'il_blog_editor',
825  $this->getRefId()
826  );
827 
828  return array();
829  }
830 
831  public function getLocalContributorRole($a_node_id)
832  {
834 
835  foreach ($rbacreview->getLocalRoles($a_node_id) as $role_id) {
836  if (substr(ilObject::_lookupTitle($role_id), 0, 19) == "il_blog_contributor") {
837  return $role_id;
838  }
839  }
840  }
841 
842  public function getLocalEditorRole($a_node_id)
843  {
845 
846  foreach ($rbacreview->getLocalRoles($a_node_id) as $role_id) {
847  if (substr(ilObject::_lookupTitle($role_id), 0, 14) == "il_blog_editor") {
848  return $role_id;
849  }
850  }
851  }
852 
853  public function getAllLocalRoles($a_node_id)
854  {
856 
857  include_once "Services/AccessControl/classes/class.ilObjRole.php";
858 
859  $res = array();
860  foreach ($rbacreview->getLocalRoles($a_node_id) as $role_id) {
862  }
863 
864  asort($res);
865  return $res;
866  }
867 
868  public function getRolesWithContributeOrRedact($a_node_id)
869  {
871 
872  include_once "Services/AccessControl/classes/class.ilObjRole.php";
873 
874  $contr_op_id = ilRbacReview::_getOperationIdByName("contribute");
875  $redact_op_id = ilRbacReview::_getOperationIdByName("redact");
876  $contr_role_id = $this->getLocalContributorRole($a_node_id);
877  $editor_role_id = $this->getLocalEditorRole($a_node_id);
878 
879  $res = array();
880  foreach ($rbacreview->getParentRoleIds($a_node_id) as $role_id => $role) {
881  if ($role_id != $contr_role_id &&
882  $role_id != $editor_role_id) {
883  $all_ops = $rbacreview->getActiveOperationsOfRole($a_node_id, $role_id);
884  if (in_array($contr_op_id, $all_ops) ||
885  in_array($redact_op_id, $all_ops)) {
886  $res[$role_id] = ilObjRole:: _getTranslation($role["title"]);
887  }
888  }
889  }
890 
891  return $res;
892  }
893 
894  protected function handleQuotaUpdate()
895  {
896  include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
898  $this->getType(),
899  $this->getId(),
900  ilUtil::dirsize($this->initStorage($this->getId())),
901  array($this->getId())
902  );
903  }
904 }
Feed writer class.
getNotesStatus()
Get notes status.
const ABSTRACT_DEFAULT_IMAGE_WIDTH
setNavMode($a_value)
setNavModeListMonthsWithPostings($a_value)
$path
Definition: aliased.php:25
const NAV_MODE_LIST_DEFAULT_POSTINGS
setAbstractImageHeight($a_value)
static removeForObject($type, $id)
Remove all notifications for given object.
setAbstractImage($a_value)
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
Class ilBlogPosting.
const IL_CAL_DATETIME
setAbstractShortenLength($a_value)
global $DIC
Definition: saml.php:7
setOverviewPostings($a_value)
$tpl
Definition: ilias.php:10
setNotesStatus($a_status)
Toggle notes status.
hasApproval()
Get approval status.
setNavModeListMonths($a_value)
getFontColor()
Get font color.
static deliverRSS($a_wsp_id)
Deliver blog as rss feed.
setAbstractImageWidth($a_value)
"color:#CC0000 style
Definition: example_001.php:92
Access handler for personal workspace.
const NAV_MODE_LIST
static _lookupTitle($a_id)
lookup object title
static updateNotificationTime($type, $id, array $user_ids, $page_id=false)
Update the last mail timestamp for given object and users.
getAbstractShortenLength()
setRSS($a_status)
Toggle RSS status.
const ABSTRACT_DEFAULT_SHORTEN_LENGTH
setAbstractShorten($a_value)
deleteImage()
remove existing file
getImage()
Get banner image.
getAllLocalRoles($a_node_id)
static lookupObjectStyle($a_obj_id)
Lookup object style.
setAuthors($a_value)
setFontColor($a_value)
Set font color.
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
hasRSS()
Get RSS status.
Tree handler for personal workspace.
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
A FeedItem represents an item in a News Feed.
static _lookupStandard($a_id)
Lookup standard flag.
getBackgroundColor()
Get background color.
getLocalEditorRole($a_node_id)
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
setProfilePicture($a_status)
Toggle profile picture status.
setOrder(array $a_values=null)
foreach($_POST as $key=> $value) $res
static execConvert($args)
execute convert command
setKeywords($a_value)
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
uploadImage(array $a_upload)
Upload new image file.
const ABSTRACT_DEFAULT_IMAGE_HEIGHT
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.
getRolesWithContributeOrRedact($a_node_id)
static _lookupObjId($a_id)
static initStorage($a_id, $a_subdir=null)
Init file system storage.
special template class to simplify handling of ITX/PEAR
Class ilObjBlog.
__construct($a_id=0, $a_reference=true)
Constructor.
doCloneObject($new_obj, $a_target_id, $a_copy_id=null, $a_omit_tree=false)
$ilUser
Definition: imgupload.php:18
setApproval($a_status)
Toggle approval status.
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _getTranslation($a_role_title)
$users
Definition: authpage.php:44
$row
static _getOperationIdByName($a_operation)
get operation id by name of operation public static
getImageFullPath($a_as_thumb=false)
Get banner image incl.
static dirsize($directory)
get size of a directory or a file.
exit
Definition: backend.php:16
hasProfilePicture()
Get profile picture status.
getStyleSheetId()
Get style sheet id.
setBackgroundColor($a_value)
Set background color.
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
global $ilSetting
Definition: privfeed.php:17
static escapeShellArg($a_arg)
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.
setStyleSheetId($a_style)
Set style sheet id.
global $ilDB
getNavModeListMonthsWithPostings()
$url
setImage($a_value)
Set banner image.
$source
Definition: linkback.php:22
static sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
const NAV_MODE_MONTH
$target
Definition: test.php:19
Wrapper classes for system notifications.
static deleteAllBlogPostings($a_blog_id)
Delete all postings for blog.
getLocalContributorRole($a_node_id)