5 require_once
"Services/Object/classes/class.ilObject2.php";
55 $set = $ilDB->query(
"SELECT * FROM il_blog".
56 " WHERE id = ".$ilDB->quote($this->id,
"integer"));
57 $row = $ilDB->fetchAssoc($set);
62 $this->
setRSS($row[
"rss_active"]);
75 if(trim($row[
"nav_order"]))
77 $this->
setOrder(explode(
";", $row[
"nav_order"]));
81 include_once(
"./Services/Notes/classes/class.ilNote.php");
84 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
92 $ilDB->manipulate(
"INSERT INTO il_blog (id,ppic,rss_active,approval".
93 ",abs_shorten,abs_shorten_len,abs_image,abs_img_width,abs_img_height".
94 ",keywords,authors,nav_mode,nav_list_post) VALUES (".
95 $ilDB->quote($this->id,
"integer").
",".
96 $ilDB->quote(
true,
"integer").
",".
97 $ilDB->quote(
true,
"integer").
",".
98 $ilDB->quote(
false,
"integer").
",".
105 $ilDB->quote($this->
hasAuthors(),
"integer").
",".
106 $ilDB->quote($this->
getNavMode(),
"integer").
",".
111 include_once(
"./Services/Notes/classes/class.ilNote.php");
129 include_once
"Modules/Blog/classes/class.ilBlogPosting.php";
133 include_once
"./Services/Notification/classes/class.ilNotification.php";
136 $ilDB->manipulate(
"DELETE FROM il_blog".
137 " WHERE id = ".$ilDB->quote($this->id,
"integer"));
146 $ilDB->manipulate(
"UPDATE il_blog".
147 " SET ppic = ".$ilDB->quote($this->hasProfilePicture(),
"integer").
148 ",bg_color = ".$ilDB->quote($this->getBackgroundColor(),
"text").
149 ",font_color = ".$ilDB->quote($this->getFontcolor(),
"text").
150 ",img = ".$ilDB->quote($this->getImage(),
"text").
151 ",rss_active = ".$ilDB->quote($this->hasRSS(),
"integer").
152 ",approval = ".$ilDB->quote($this->hasApproval(),
"integer").
153 ",abs_shorten = ".$ilDB->quote($this->hasAbstractShorten(),
"integer").
154 ",abs_shorten_len = ".$ilDB->quote($this->getAbstractShortenLength(),
"integer").
155 ",abs_image = ".$ilDB->quote($this->hasAbstractImage(),
"integer").
156 ",abs_img_width = ".$ilDB->quote($this->getAbstractImageWidth(),
"integer").
157 ",abs_img_height = ".$ilDB->quote($this->getAbstractImageHeight(),
"integer").
158 ",keywords = ".$ilDB->quote($this->hasKeywords(),
"integer").
159 ",authors = ".$ilDB->quote($this->hasAuthors(),
"integer").
160 ",nav_mode = ".$ilDB->quote($this->getNavMode(),
"integer").
161 ",nav_list_post = ".$ilDB->quote($this->getNavModeListPostings(),
"integer").
162 ",nav_list_mon = ".$ilDB->quote($this->getNavModeListMonths(),
"integer").
163 ",ov_post = ".$ilDB->quote($this->getOverviewPostings(),
"integer").
164 ",nav_order = ".$ilDB->quote(implode(
";", $this->
getOrder()),
"text").
165 " WHERE id = ".$ilDB->quote($this->
id,
"integer"));
168 include_once(
"./Services/Notes/classes/class.ilNote.php");
171 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
176 protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = null, $a_omit_tree =
false)
182 $new_obj->setImage(
$img);
185 $target = $new_obj->initStorage($new_obj->getId());
187 copy($source.$img,
$target.$img);
194 $new_obj->setRSS($this->
hasRSS());
204 include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
209 $new_id = $style_obj->ilClone();
210 $new_obj->setStyleSheetId($new_id);
232 $this->notes = (bool)$a_status;
252 $this->ppic = (bool)$a_status;
264 $this->bg_color =
"ffffff";
276 $this->bg_color = (
string)$a_value;
286 if(!$this->font_color)
288 $this->font_color =
"505050";
300 $this->font_color = (
string)$a_value;
320 $this->img = (
string)$a_value;
335 return $path.$this->img;
351 include_once
"Modules/Blog/classes/class.ilFSStorageBlog.php";
370 include_once
"Modules/Blog/classes/class.ilFSStorageBlog.php";
374 $path = $storage->getAbsolutePath().
"/";
378 $path .= $a_subdir.
"/";
405 $clean_name = preg_replace(
"/[^a-zA-Z0-9\_\.\-]/",
"", $a_upload[
"name"]);
408 $original =
"org_".$this->id.
"_".$clean_name;
409 $thumb =
"thb_".$this->id.
"_".$clean_name;
410 $processed = $this->
id.
"_".$clean_name;
414 chmod(
$path.$original, 0770);
421 $dimensions = $blga_set->get(
"banner_width");
428 ilUtil::execConvert($original_file.
"[0] -geometry 100x100 -quality 100 JPEG:".$thumb_file);
429 ilUtil::execConvert($original_file.
"[0] -geometry ".$dimensions.
" -quality 100 JPEG:".$processed_file);
457 $this->rss = (bool)$a_status;
477 $this->approval = (bool)$a_status;
497 $this->
style = (int)$a_style;
507 $this->abstract_shorten = (bool)$a_value;
517 $this->abstract_shorten_length = (int)$a_value;
527 $this->abstract_image = (bool)$a_value;
537 $this->abstract_image_width = (int)$a_value;
547 $this->abstract_image_height = (int)$a_value;
552 $this->keywords = (bool)$a_value;
562 $this->authors = (bool)$a_value;
572 $a_value = (int)$a_value;
573 if(in_array($a_value,
array(self::NAV_MODE_LIST, self::NAV_MODE_MONTH)))
575 $this->nav_mode = $a_value;
586 $this->nav_mode_list_postings = (int)$a_value;
602 $a_value = (int)$a_value;
604 $this->nav_mode_list_months = $a_value;
620 $a_value = (int)$a_value;
622 $this->overview_postings = $a_value;
632 $this->order = $a_values;
640 static function sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment = null)
647 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
648 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
656 $access_handler = null;
663 include_once
"./Modules/Blog/classes/class.ilBlogPosting.php";
667 $ignore_threshold = ($a_action ==
"comment");
672 if(!$posting->isApproved())
674 $blog =
new self($blog_obj_id,
false);
675 if($blog->hasApproval())
686 $ignore_threshold =
true;
687 $a_action =
"approve";
695 in_array($a_action,
array(
"update",
"new")))
697 $posting->handleNews(($a_action ==
"update"));
701 include_once
"./Services/Notification/classes/class.ilNotification.php";
703 $blog_obj_id, $a_posting_id, $ignore_threshold);
709 include_once
"./Services/Notification/classes/class.ilSystemNotification.php";
711 $ntf->setLangModules(
array(
"blog"));
712 $ntf->setRefId($a_blog_node_id);
713 $ntf->setChangedByUserId($ilUser->getId());
714 $ntf->setSubjectLangId(
'blog_change_notification_subject');
715 $ntf->setIntroductionLangId(
'blog_change_notification_body_'.$a_action);
716 $ntf->addAdditionalInfo(
'blog_posting', $posting->getTitle());
719 $ntf->addAdditionalInfo(
'comment', $a_comment,
true);
721 $ntf->setGotoLangId(
'blog_change_notification_link');
722 $ntf->setReasonLangId(
'blog_change_notification_reason');
724 $abstract = $posting->getNotificationAbstract();
727 $ntf->addAdditionalInfo(
'content', $abstract,
true);
730 $notified = $ntf->sendMail($users,
"_".$a_posting_id,
731 ($admin_only ?
"write" :
"read"));
734 if(
sizeof($notified))
749 if(!$ilSetting->get(
'enable_global_profiles'))
755 if(substr($a_wsp_id, -4) !=
"_cll")
757 include_once
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
759 $obj_id = $wsp_id->lookupObjectId($a_wsp_id);
764 $a_wsp_id = substr($a_wsp_id, 0, -4);
773 $blog =
new self($obj_id,
false);
779 include_once
"Services/Feeds/classes/class.ilFeedWriter.php";
782 include_once
"Services/Link/classes/class.ilLink.php";
784 $url = str_replace(
"&",
"&",
$url);
787 $feed->setChannelTitle(str_replace(
"&",
"&", $blog->getTitle()));
788 $feed->setChannelDescription(str_replace(
"&",
"&", $blog->getDescription()));
789 $feed->setChannelLink(
$url);
792 $tpl =
new ilTemplate(
"tpl.main.html",
true,
true);
794 include_once(
"./Modules/Blog/classes/class.ilBlogPosting.php");
795 include_once(
"./Modules/Blog/classes/class.ilBlogPostingGUI.php");
809 $snippet = str_replace(
"&",
"&", $snippet);
810 $snippet =
"<![CDATA[".$snippet.
"]]>";
813 $url = str_replace(
"&",
"&",
$url);
816 $feed_item->setTitle(str_replace(
"&",
"&", $item[
"title"]));
818 $feed_item->setDescription($snippet);
819 $feed_item->setLink(
$url);
820 $feed_item->setAbout(
$url);
821 $feed->addItem($feed_item);
830 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
832 'il_blog_contributor_'.$this->
getRefId(),
833 "Contributor of blog obj_no.".$this->
getId(),
834 'il_blog_contributor',
838 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
840 'il_blog_editor_'.$this->
getRefId(),
841 "Editor of blog obj_no.".$this->
getId(),
853 foreach($rbacreview->getLocalRoles($a_node_id) as $role_id)
866 foreach($rbacreview->getLocalRoles($a_node_id) as $role_id)
879 include_once
"Services/AccessControl/classes/class.ilObjRole.php";
882 foreach($rbacreview->getLocalRoles($a_node_id) as $role_id)
895 include_once
"Services/AccessControl/classes/class.ilObjRole.php";
903 foreach($rbacreview->getParentRoleIds($a_node_id) as $role_id => $role)
905 if($role_id != $contr_role_id &&
906 $role_id != $editor_role_id)
908 $all_ops = $rbacreview->getActiveOperationsOfRole($a_node_id, $role_id);
909 if(in_array($contr_op_id, $all_ops) ||
910 in_array($redact_op_id, $all_ops))
922 include_once
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
getNotesStatus()
Get notes status.
const ABSTRACT_DEFAULT_IMAGE_WIDTH
const NAV_MODE_LIST_DEFAULT_POSTINGS
setAbstractImageHeight($a_value)
static removeForObject($type, $id)
Remove all notifications for given object.
setAbstractImage($a_value)
setAbstractShortenLength($a_value)
setOverviewPostings($a_value)
setNotesStatus($a_status)
Toggle notes status.
static _getStaticLink($a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
hasApproval()
Get approval status.
setNavModeListMonths($a_value)
getFontColor()
Get font color.
static deliverRSS($a_wsp_id)
Deliver blog as rss feed.
setAbstractImageWidth($a_value)
Access handler for personal workspace.
static _lookupTitle($a_id)
lookup object title
Add rich text string
The name of the decorator.
static updateNotificationTime($type, $id, array $user_ids, $page_id=false)
Update the last mail timestamp for given object and users.
setNavModeListPostings($a_value)
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.
setFontColor($a_value)
Set font color.
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
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)
static execConvert($args)
execute convert command
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 moveUploadedFile($a_file, $a_name, $a_target, $a_raise_errors=true, $a_mode="move_uploaded")
move uploaded file
static _lookupObjId($a_id)
static initStorage($a_id, $a_subdir=null)
Init file system storage.
special template class to simplify handling of ITX/PEAR
doCloneObject($new_obj, $a_target_id, $a_copy_id=null, $a_omit_tree=false)
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)
Create styles array
The data for the language used.
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.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type)
Are comments activated for object?
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.
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.
lookupObjectId($a_node_id)
Get object id for node id.
setStyleSheetId($a_style)
Set style sheet id.
Class ilObject2 This is an intermediate progress of ilObject class.
setImage($a_value)
Set banner image.
static sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
Wrapper classes for system notifications.
static deleteAllBlogPostings($a_blog_id)
Delete all postings for blog.
getLocalContributorRole($a_node_id)