5require_once 
"Services/Object/classes/class.ilObject2.php";
 
   25        parent::__construct($a_id, $a_reference);
 
   26        $this->rbacreview = 
$DIC->rbac()->review();
 
   67        $set = 
$ilDB->query(
"SELECT * FROM il_blog" .
 
   68                " WHERE id = " . 
$ilDB->quote($this->id, 
"integer"));
 
   74        $this->
setRSS($row[
"rss_active"]);
 
   87        if (trim(
$row[
"nav_order"])) {
 
   92        include_once(
"./Services/Notes/classes/class.ilNote.php");
 
   95        include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
 
  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") .
 
  122        include_once(
"./Services/Notes/classes/class.ilNote.php");
 
  140        include_once 
"Modules/Blog/classes/class.ilBlogPosting.php";
 
  144        include_once 
"./Services/Notification/classes/class.ilNotification.php";
 
  147        $ilDB->manipulate(
"DELETE FROM il_blog" .
 
  148            " WHERE id = " . 
$ilDB->quote($this->id, 
"integer"));
 
  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"));
 
  178            include_once(
"./Services/Notes/classes/class.ilNote.php");
 
  181            include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
 
  186    protected function doCloneObject($new_obj, $a_target_id, $a_copy_id = 
null, $a_omit_tree = 
false)
 
  191            $new_obj->setImage(
$img);
 
  194            $target = $new_obj->initStorage($new_obj->getId());
 
  203        $new_obj->setRSS($this->
hasRSS());
 
  213        include_once(
"./Services/Style/Content/classes/class.ilObjStyleSheet.php");
 
  217            $new_id = $style_obj->ilClone();
 
  218            $new_obj->setStyleSheetId($new_id);
 
  240        $this->notes = (bool) $a_status;
 
  260        $this->ppic = (bool) $a_status;
 
  270        if (!$this->bg_color) {
 
  271            $this->bg_color = 
"ffffff";
 
  283        $this->bg_color = (string) $a_value;
 
  293        if (!$this->font_color) {
 
  294            $this->font_color = 
"505050";
 
  306        $this->font_color = (string) $a_value;
 
  326        $this->img = (string) $a_value;
 
  352            include_once 
"Modules/Blog/classes/class.ilFSStorageBlog.php";
 
  371        include_once 
"Modules/Blog/classes/class.ilFSStorageBlog.php";
 
  375        $path = $storage->getAbsolutePath() . 
"/";
 
  378            $path .= $a_subdir . 
"/";
 
  380            if (!is_dir(
$path)) {
 
  403        $clean_name = preg_replace(
"/[^a-zA-Z0-9\_\.\-]/", 
"", $a_upload[
"name"]);
 
  406        $original = 
"org_" . $this->
id . 
"_" . $clean_name;
 
  407        $thumb = 
"thb_" . $this->
id . 
"_" . $clean_name;
 
  408        $processed = $this->
id . 
"_" . $clean_name;
 
  410        if (ilUtil::moveUploadedFile($a_upload[
"tmp_name"], $original, 
$path . $original)) {
 
  411            chmod(
$path . $original, 0770);
 
  418            $dimensions = $blga_set->get(
"banner_width");
 
  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);
 
  454        $this->rss = (bool) $a_status;
 
  474        $this->approval = (bool) $a_status;
 
  494        $this->style = (int) $a_style;
 
  504        $this->abstract_shorten = (bool) $a_value;
 
  514        $this->abstract_shorten_length = (int) $a_value;
 
  524        $this->abstract_image = (bool) $a_value;
 
  534        $this->abstract_image_width = (int) $a_value;
 
  544        $this->abstract_image_height = (int) $a_value;
 
  549        $this->keywords = (bool) $a_value;
 
  559        $this->authors = (bool) $a_value;
 
  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;
 
  582        $this->nav_mode_list_months_with_post = (int) $a_value;
 
  587        return $this->nav_mode_list_months_with_post;
 
  595            $a_value = (int) $a_value;
 
  597        $this->nav_mode_list_months = $a_value;
 
  610            $a_value = (int) $a_value;
 
  612        $this->overview_postings = $a_value;
 
  622        $this->order = $a_values;
 
  630    public static function sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment = 
null)
 
  638            include_once 
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
 
  639            include_once 
"Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
 
  641            $blog_obj_id = 
$tree->lookupObjectId($a_blog_node_id);
 
  645            $access_handler = 
null;
 
  651        include_once 
"./Modules/Blog/classes/class.ilBlogPosting.php";
 
  655        $ignore_threshold = ($a_action == 
"comment");
 
  660        if (!$posting->isApproved()) {
 
  661            $blog = 
new self($blog_obj_id, 
false);
 
  662            if ($blog->hasApproval()) {
 
  671                        $ignore_threshold = 
true;
 
  672                        $a_action = 
"approve";
 
  680            in_array($a_action, array(
"update", 
"new"))) {
 
  681            $posting->handleNews(($a_action == 
"update"));
 
  685        include_once 
"./Services/Notification/classes/class.ilNotification.php";
 
  696        include_once 
"./Services/Notification/classes/class.ilSystemNotification.php";
 
  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());
 
  705            $ntf->addAdditionalInfo(
'comment', $a_comment, 
true);
 
  707        $ntf->setGotoLangId(
'blog_change_notification_link');
 
  708        $ntf->setReasonLangId(
'blog_change_notification_reason');
 
  710        $abstract = $posting->getNotificationAbstract();
 
  712            $ntf->addAdditionalInfo(
'content', $abstract, 
true);
 
  715        $notified = $ntf->sendMail(
 
  718            ($admin_only ? 
"write" : 
"read")
 
  722        if (
sizeof($notified)) {
 
  739        if (!
$ilSetting->get(
'enable_global_profiles')) {
 
  744        if (substr($a_wsp_id, -4) != 
"_cll") {
 
  745            include_once 
"Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
 
  747            $obj_id = $wsp_id->lookupObjectId($a_wsp_id);
 
  750            $a_wsp_id = substr($a_wsp_id, 0, -4);
 
  758        $blog = 
new self($obj_id, 
false);
 
  759        if (!$blog->hasRSS()) {
 
  763        include_once 
"Services/Feeds/classes/class.ilFeedWriter.php";
 
  766        include_once 
"Services/Link/classes/class.ilLink.php";
 
  768        $url = str_replace(
"&", 
"&", 
$url);
 
  771        $feed->setChannelTitle(str_replace(
"&", 
"&", $blog->getTitle()));
 
  772        $feed->setChannelDescription(str_replace(
"&", 
"&", $blog->getDescription()));
 
  773        $feed->setChannelLink(
$url);
 
  778        include_once(
"./Modules/Blog/classes/class.ilBlogPosting.php");
 
  779        include_once(
"./Modules/Blog/classes/class.ilBlogPostingGUI.php");
 
  791            $snippet = str_replace(
"&", 
"&", $snippet);
 
  792            $snippet = 
"<![CDATA[" . $snippet . 
"]]>";
 
  795            $url = str_replace(
"&", 
"&", 
$url);
 
  798            $feed_item->setTitle(str_replace(
"&", 
"&", $item[
"title"])); 
 
  800            $feed_item->setDescription($snippet);
 
  801            $feed_item->setLink(
$url);
 
  802            $feed_item->setAbout(
$url);
 
  803            $feed->addItem($feed_item);
 
  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',
 
  820        include_once 
'./Services/AccessControl/classes/class.ilObjRole.php';
 
  822            'il_blog_editor_' . $this->
getRefId(),
 
  823            "Editor of blog obj_no." . $this->
getId(),
 
  835        foreach (
$rbacreview->getLocalRoles($a_node_id) as $role_id) {
 
  846        foreach (
$rbacreview->getLocalRoles($a_node_id) as $role_id) {
 
  857        include_once 
"Services/AccessControl/classes/class.ilObjRole.php";
 
  860        foreach (
$rbacreview->getLocalRoles($a_node_id) as $role_id) {
 
  872        include_once 
"Services/AccessControl/classes/class.ilObjRole.php";
 
  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)) {
 
  896        include_once 
"Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
 
  901            array($this->
getId())
 
An exception for terminatinating execution or to throw for unit testing.
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.
static getAllPostings($a_blog_id, $a_limit=1000, $a_offset=0)
Get all postings of blog.
static deleteAllBlogPostings($a_blog_id)
Delete all postings for blog.
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.
A FeedItem represents an item in a News Feed.
static _getStaticLink( $a_ref_id, $a_type='', $a_fallback_goto=true, $append="")
Get static link.
static commentsActivated($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_news_id=0)
Are comments activated for object?
static activateComments($a_rep_obj_id, $a_obj_id, $a_obj_type, $a_activate=true)
Activate notes feature.
static removeForObject($type, $id)
Remove all notifications for given object.
static getNotificationsForObject($type, $id, $page_id=null, $ignore_threshold=false)
Get all users for given object.
static updateNotificationTime($type, $id, array $user_ids, $page_id=false)
Update the last mail timestamp for given object and users.
setBackgroundColor($a_value)
Set background color.
getRolesWithContributeOrRedact($a_node_id)
setProfilePicture($a_status)
Toggle profile picture status.
setNavModeListMonthsWithPostings($a_value)
setFontColor($a_value)
Set font color.
hasProfilePicture()
Get profile picture status.
setNotesStatus($a_status)
Toggle notes status.
getStyleSheetId()
Get style sheet id.
static sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment=null)
getLocalContributorRole($a_node_id)
static deliverRSS($a_wsp_id)
Deliver blog as rss feed.
deleteImage()
remove existing file
setAbstractShorten($a_value)
getFontColor()
Get font color.
getImageFullPath($a_as_thumb=false)
Get banner image incl.
setAbstractShortenLength($a_value)
setRSS($a_status)
Toggle RSS status.
initDefaultRoles()
init default roles settings Purpose of this function is to create a local role folder and local roles...
setAbstractImage($a_value)
setOrder(array $a_values=null)
setOverviewPostings($a_value)
uploadImage(array $a_upload)
Upload new image file.
setAbstractImageHeight($a_value)
static initStorage($a_id, $a_subdir=null)
Init file system storage.
getLocalEditorRole($a_node_id)
getBackgroundColor()
Get background color.
getAbstractShortenLength()
const ABSTRACT_DEFAULT_SHORTEN_LENGTH
getAllLocalRoles($a_node_id)
const ABSTRACT_DEFAULT_IMAGE_WIDTH
const NAV_MODE_LIST_DEFAULT_POSTINGS
doCloneObject($new_obj, $a_target_id, $a_copy_id=null, $a_omit_tree=false)
setStyleSheetId($a_style)
Set style sheet id.
setAbstractImageWidth($a_value)
setNavModeListMonths($a_value)
hasApproval()
Get approval status.
setApproval($a_status)
Toggle approval status.
getImage()
Get banner image.
getNavModeListMonthsWithPostings()
getNotesStatus()
Get notes status.
__construct($a_id=0, $a_reference=true)
Constructor.
const ABSTRACT_DEFAULT_IMAGE_HEIGHT
setImage($a_value)
Set banner image.
static _getTranslation($a_role_title)
static createDefaultRole($a_title, $a_description, $a_tpl_name, $a_ref_id)
static _lookupStandard($a_id)
Lookup standard flag.
static lookupObjectStyle($a_obj_id)
Lookup object style.
static writeStyleUsage($a_obj_id, $a_style_id)
Write style usage.
Class ilObject2 This is an intermediate progress of ilObject class.
getRefId()
get reference id @access public
getType()
get object type @access public
getId()
get object id @access public
static getInstanceByObjId($a_obj_id, $stop_on_error=true)
get an instance of an Ilias object by object id
static _lookupObjId($a_id)
static _lookupTitle($a_id)
lookup object title
static _lookupActive($a_id, $a_parent_type, $a_check_scheduled_activation=false, $a_lang="-")
lookup activation status
static _getOperationIdByName($a_operation)
get operation id by name of operation @access public @access static
Wrapper classes for system notifications.
special template class to simplify handling of ITX/PEAR
static escapeShellArg($a_arg)
static execConvert($args)
execute convert command
static dirsize($directory)
get size of a directory or a file.
Access handler for personal workspace.
Tree handler for personal workspace.
foreach($_POST as $key=> $value) $res