Example #1
0
 /**
  * The basic properties of a file object are stored in table object_data.
  * This is not sufficient for a file object. Therefore we create additional
  * properties in table file_data.
  * This method has been put into a separate operation, to allow a WebDAV Null resource
  * (class.ilObjNull.php) to become a file object.
  */
 function createProperties($a_upload = false, $a_prevent_meta_data_creation = false)
 {
     global $ilDB, $tree;
     // Create file directory
     $this->initFileStorage();
     $this->file_storage->create();
     if ($a_upload) {
         return true;
     }
     // not upload mode
     require_once "./Services/History/classes/class.ilHistory.php";
     ilHistory::_createEntry($this->getId(), "create", $this->getFileName() . ",1");
     $this->addNewsNotification("file_created");
     require_once "./Services/News/classes/class.ilNewsItem.php";
     $default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($_GET['ref_id']);
     if ($default_visibility == "public") {
         ilBlockSetting::_write("news", "public_notifications", 1, 0, $this->getId());
     }
     $q = "INSERT INTO file_data (file_id,file_name,file_type,file_size,version,f_mode) " . "VALUES (" . $ilDB->quote($this->getId(), 'integer') . "," . $ilDB->quote($this->getFileName(), 'text') . "," . $ilDB->quote($this->getFileType(), 'text') . "," . $ilDB->quote((int) $this->getFileSize(), 'integer') . "," . $ilDB->quote(1, 'integer') . "," . $ilDB->quote($this->getMode(), 'text') . ")";
     $res = $ilDB->manipulate($q);
     // no meta data handling for file list files
     if ($this->getMode() != "filelist" && !$a_prevent_meta_data_creation) {
         $this->createMetaData();
     }
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl, $ilAccess;
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     // user
     if ($a_set["user_id"] > 0) {
         $this->tpl->setCurrentBlock("user_info");
         $user_obj = new ilObjUser($a_set["user_id"]);
         $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
         $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
         $this->tpl->parseCurrentBlock();
     }
     // access
     if ($enable_internal_rss) {
         $this->tpl->setCurrentBlock("access");
         $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
         if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $a_set["context_obj_id"])) {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
         } else {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
         }
         $this->tpl->parseCurrentBlock();
     }
     // last update
     if ($a_set["creation_date"] != $a_set["update_date"]) {
         $this->tpl->setCurrentBlock("ni_update");
         $this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
         $this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME)));
         $this->tpl->parseCurrentBlock();
     }
     // creation date
     $this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME)));
     $this->tpl->setVariable("TXT_CREATED", $lng->txt("created"));
     // title
     $this->tpl->setVariable("VAL_TITLE", $a_set["title"]);
     // content
     if ($a_set["content"] != "") {
         $this->tpl->setCurrentBlock("content");
         $this->tpl->setVariable("VAL_CONTENT", ilUtil::shortenText($a_set["content"], 80, true, true), true);
         $this->tpl->parseCurrentBlock();
     }
     $perm_ref_id = $this->perm_ref_id > 0 ? $this->perm_ref_id : $a_set["ref_id"];
     if ($ilAccess->checkAccess("write", "", $perm_ref_id)) {
         $this->tpl->setCurrentBlock("edit");
         $this->tpl->setVariable("TXT_EDIT", $lng->txt("edit"));
         $ilCtrl->setParameterByClass("ilnewsitemgui", "news_item_id", $a_set["id"]);
         $this->tpl->setVariable("CMD_EDIT", $ilCtrl->getLinkTargetByClass("ilnewsitemgui", "editNewsItem"));
         $this->tpl->parseCurrentBlock();
     }
     // context
     $this->tpl->setVariable("CONTEXT", $lng->txt("obj_" . $a_set["context_obj_type"]) . ":<br />" . ilObject::_lookupTitle($a_set["context_obj_id"]));
     $this->tpl->setVariable("VAL_ID", $a_set["id"]);
 }
 /**
  * Save settings.
  */
 function saveSettings()
 {
     global $ilCtrl, $ilUser;
     $this->initSettingsForm();
     if ($this->settings_form->checkInput()) {
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         if ($enable_internal_rss) {
             ilBlockSetting::_write($this->getBlockType(), "public_notifications", $_POST["notifications_public"], 0, $this->block_id);
             ilBlockSetting::_write($this->getBlockType(), "public_feed", $_POST["notifications_public_feed"], 0, $this->block_id);
             ilBlockSetting::_write($this->getBlockType(), "default_visibility", $_POST["default_visibility"], 0, $this->block_id);
         }
         if ($this->getProperty("hide_news_block_option")) {
             ilBlockSetting::_write($this->getBlockType(), "hide_news_block", $_POST["hide_news_block"], 0, $this->block_id);
             ilBlockSetting::_write($this->getBlockType(), "hide_news_per_date", $_POST["hide_news_per_date"], 0, $this->block_id);
             // hide date
             $hd = $this->settings_form->getInput("hide_news_date");
             $hide_date = new ilDateTime($hd["date"] . " " . $hd["time"], IL_CAL_DATETIME, $ilUser->getTimeZone());
             ilBlockSetting::_write($this->getBlockType(), "hide_news_date", $hide_date->get(IL_CAL_DATETIME), 0, $this->block_id);
         }
         include_once "./Services/News/classes/class.ilNewsCache.php";
         $cache = new ilNewsCache();
         $cache->deleteEntry($ilUser->getId() . ":" . $_GET["ref_id"]);
         $ilCtrl->returnToParent($this);
     } else {
         $this->settings_form->setValuesByPost();
         return $this->settings_form->getHtml();
     }
 }
 function _lookupUserPDPeriod($a_user_id)
 {
     global $ilSetting;
     $news_set = new ilSetting("news");
     $allow_shorter_periods = $news_set->get("allow_shorter_periods");
     $allow_longer_periods = $news_set->get("allow_longer_periods");
     $default_per = ilNewsItem::_lookupDefaultPDPeriod();
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     $per = ilBlockSetting::_lookup("pdnews", "news_pd_period", $a_user_id, 0);
     // news period information
     if ($per <= 0 || !$allow_shorter_periods && $per < $default_per || !$allow_longer_periods && $per > $default_per) {
         $per = $default_per;
     }
     return $per;
 }
 /**
  * Save Settings
  */
 function saveSettingsObject()
 {
     global $ilCtrl, $ilTabs;
     $this->checkPermission("write");
     $ilTabs->activateTab("id_settings");
     $this->initSettingsForm();
     if ($this->form_gui->checkInput()) {
         $news_set = new ilSetting("news");
         $enable_internal_rss = $news_set->get("enable_rss_for_internal");
         $this->object->setTitle($this->form_gui->getInput("title"));
         $this->object->setDescription($this->form_gui->getInput("description"));
         $this->object->setOnline($this->form_gui->getInput("online"));
         $this->object->setDownloadable($this->form_gui->getInput("downloadable"));
         $this->object->setOrder($this->form_gui->getInput("order"));
         $this->object->setViewMode($this->form_gui->getInput("viewmode"));
         if ($enable_internal_rss) {
             $this->object->setPublicFiles($this->form_gui->getInput("public_files"));
             $this->object->setDefaultAccess($this->form_gui->getInput("defaultaccess"));
         }
         $this->object->update();
         if ($enable_internal_rss) {
             include_once "./Services/Block/classes/class.ilBlockSetting.php";
             ilBlockSetting::_write("news", "public_feed", $this->form_gui->getInput("extra_feed"), 0, $this->object->getId());
             ilBlockSetting::_write("news", "keep_rss_min", $this->form_gui->getInput("keep_rss_min"), 0, $this->object->getId());
         }
         ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
         $ilCtrl->redirect($this, "editSettings");
     } else {
         $this->form_gui->setValuesByPost();
         $this->tpl->setContent($this->form_gui->getHTML());
     }
 }
 /**
  * delete object or referenced object
  * (in the case of a referenced object, object data is only deleted
  * if last reference is deleted)
  * This function removes an object entirely from system!!
  *
  * @access	public
  * @return	boolean	true if object was removed completely; false if only a references was removed
  */
 function delete()
 {
     global $rbacadmin, $log, $ilDB;
     $remove = false;
     // delete object_data entry
     if (!$this->referenced || $this->countReferences() == 1) {
         // check type match
         $db_type = ilObject::_lookupType($this->getId());
         if ($this->type != $db_type) {
             $message = "ilObject::delete(): Type mismatch. Object with obj_id: " . $this->id . " " . "was instantiated by type '" . $this->type . "'. DB type is: " . $db_type;
             // write log entry
             $log->write($message);
             // raise error
             $this->ilias->raiseError("ilObject::delete(): Type mismatch. (" . $this->type . "/" . $this->id . ")", $this->ilias->error_obj->WARNING);
         }
         // delete entry in object_data
         $q = "DELETE FROM object_data " . "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
         $ilDB->manipulate($q);
         // delete long description
         $query = "DELETE FROM object_description WHERE obj_id = " . $ilDB->quote($this->getId(), "integer");
         $ilDB->manipulate($query);
         // write log entry
         $log->write("ilObject::delete(), deleted object, obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle());
         // remove news
         include_once "./Services/News/classes/class.ilNewsItem.php";
         $news_item = new ilNewsItem();
         $news_item->deleteNewsOfContext($this->getId(), $this->getType());
         include_once "./Services/Block/classes/class.ilBlockSetting.php";
         ilBlockSetting::_deleteSettingsOfBlock($this->getId(), "news");
         include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
         ilDidacticTemplateObjSettings::deleteByObjId($this->getId());
         /* remove notes (see infoscreen gui)
         			   as they can be seen as personal data we are keeping them for now
         			include_once("Services/Notes/classes/class.ilNote.php");
         			foreach(array(IL_NOTE_PRIVATE, IL_NOTE_PUBLIC) as $note_type)
         			{
         				foreach(ilNote::_getNotesOfObject($this->id, 0, $this->type, $note_type) as $note)
         				{
         					$note->delete();
         				}
         			}
         		    */
         // BEGIN WebDAV: Delete WebDAV properties
         $query = "DELETE FROM dav_property " . "WHERE obj_id = " . $ilDB->quote($this->getId(), 'integer');
         $res = $ilDB->manipulate($query);
         // END WebDAV: Delete WebDAV properties
         include_once './Services/Tracking/classes/class.ilChangeEvent.php';
         ilChangeEvent::_delete($this->getId());
         include_once './Services/Tracking/classes/class.ilLPCollections.php';
         ilLPCollections::_deleteAll($this->getId());
         include_once './Services/WebServices/ECS/classes/class.ilECSImport.php';
         ilECSImport::_deleteByObjId($this->getId());
         $remove = true;
     } else {
         // write log entry
         $log->write("ilObject::delete(), object not deleted, number of references: " . $this->countReferences() . ", obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle());
     }
     // delete object_reference entry
     if ($this->referenced) {
         include_once "Services/Object/classes/class.ilObjectActivation.php";
         ilObjectActivation::deleteAllEntries($this->getRefId());
         // delete entry in object_reference
         $query = "DELETE FROM object_reference " . "WHERE ref_id = " . $ilDB->quote($this->getRefId(), 'integer');
         $res = $ilDB->manipulate($query);
         // write log entry
         $log->write("ilObject::delete(), reference deleted, ref_id: " . $this->getRefId() . ", obj_id: " . $this->getId() . ", type: " . $this->getType() . ", title: " . $this->getTitle());
         // DELETE PERMISSION ENTRIES IN RBAC_PA
         // DONE: method overwritten in ilObjRole & ilObjUser.
         // this call only applies for objects in rbac (not usr,role,rolt)
         // TODO: Do this for role templates too
         $rbacadmin->revokePermission($this->getRefId(), 0, false);
         include_once "Services/AccessControl/classes/class.ilRbacLog.php";
         ilRbacLog::delete($this->getRefId());
         // Remove applied didactic template setting
         include_once './Services/DidacticTemplate/classes/class.ilDidacticTemplateObjSettings.php';
         ilDidacticTemplateObjSettings::deleteByRefId($this->getRefId());
         // Remove desktop items
         ilUtil::removeItemFromDesktops($this->getRefId());
     }
     // remove conditions
     if ($this->referenced) {
         $ch =& new ilConditionHandler();
         $ch->delete($this->getRefId());
         unset($ch);
     }
     return $remove;
 }
 function ilObjectFeedWriter($a_ref_id, $a_userid = false, $a_purpose = false)
 {
     global $ilSetting, $lng;
     parent::ilFeedWriter();
     if ($a_ref_id <= 0) {
         return;
     }
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     $news_set = new ilSetting("news");
     if (!$news_set->get("enable_rss_for_internal")) {
         return;
     }
     $obj_id = ilObject::_lookupObjId($a_ref_id);
     $obj_type = ilObject::_lookupType($obj_id);
     $obj_title = ilObject::_lookupTitle($obj_id);
     if (!ilBlockSetting::_lookup("news", "public_feed", 0, $obj_id)) {
         return;
     }
     if ($ilSetting->get('short_inst_name') != "") {
         $this->setChannelTitle($ilSetting->get('short_inst_name') . " - " . $this->prepareStr($loc . $obj_title));
     } else {
         $this->setChannelTitle("ILIAS" . " - " . $this->prepareStr($loc . $obj_title . ($a_purpose ? " - " . $a_purpose : "")));
     }
     $this->setChannelAbout(ILIAS_HTTP_PATH);
     $this->setChannelLink(ILIAS_HTTP_PATH);
     // not nice, to do: general solution
     if ($obj_type == "mcst") {
         include_once "./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
         if (!ilObjMediaCastAccess::_lookupOnline($obj_id)) {
             $lng->loadLanguageModule("mcst");
             $feed_item = new ilFeedItem();
             $feed_item->setTitle($lng->txt("mcst_media_cast_not_online"));
             $feed_item->setDescription($lng->txt("mcst_media_cast_not_online_text"));
             $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"]);
             $this->addItem($feed_item);
             return;
         }
     }
     include_once "./Services/Locator/classes/class.ilLocatorGUI.php";
     $cont_loc = new ilLocatorGUI();
     $cont_loc->addContextItems($a_ref_id, true);
     $cont_loc->setTextOnly(true);
     $loc = $cont_loc->getTextVersion();
     if (trim($loc) != "") {
         $loc = " [" . $loc . "] ";
     }
     $rss_period = ilNewsItem::_lookupRSSPeriod();
     ilNewsItem::setPrivateFeedId($a_userid);
     $news_item = new ilNewsItem();
     $news_item->setContextObjId($obj_id);
     $news_item->setContextObjType($obj_type);
     $items = $news_item->getNewsForRefId($a_ref_id, true, false, $rss_period, true);
     if ($a_purpose) {
         include_once "./Services/MediaObjects/classes/class.ilMediaItem.php";
     }
     $i = 0;
     foreach ($items as $item) {
         $i++;
         if ($a_purpose != false && $obj_type == "mcst") {
             $mob = ilMediaItem::_getMediaItemsOfMObId($item[mob_id], $a_purpose);
             if ($mob == false) {
                 continue;
             }
         }
         $obj_title = ilObject::_lookupTitle($item["context_obj_id"]);
         $feed_item = new ilFeedItem();
         $title = ilNewsItem::determineNewsTitle($item["context_obj_type"], $item["title"], $item["content_is_lang_var"], $item["agg_ref_id"], $item["aggregation"]);
         // path
         $cont_loc = new ilLocatorGUI();
         $cont_loc->addContextItems($item["ref_id"], true, $a_ref_id);
         $cont_loc->setTextOnly(true);
         $loc = $cont_loc->getHTML();
         if (trim($loc) != "") {
             $loc = "[" . $loc . "]";
         }
         if ($news_set->get("rss_title_format") == "news_obj") {
             $sep = trim($this->prepareStr($loc)) == "" ? "" : " ";
             $feed_item->setTitle($this->prepareStr($title) . " (" . $this->prepareStr($loc) . $sep . $this->prepareStr($obj_title) . ")");
         } else {
             $feed_item->setTitle($this->prepareStr($loc) . " " . $this->prepareStr($obj_title) . ": " . $this->prepareStr($title));
         }
         $feed_item->setDescription($this->prepareStr(nl2br(ilNewsItem::determineNewsContent($item["context_obj_type"], $item["content"], $item["content_text_is_lang_var"]))));
         // lm hack, not nice
         if (in_array($item["context_obj_type"], array("dbk", "lm")) && $item["context_sub_obj_type"] == "pg" && $item["context_sub_obj_id"] > 0) {
             $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=pg_" . $item["context_sub_obj_id"] . "_" . $item["ref_id"]);
         } else {
             if ($item["context_obj_type"] == "wiki" && $item["context_sub_obj_type"] == "wpg" && $item["context_sub_obj_id"] > 0) {
                 include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
                 $wptitle = ilWikiPage::lookupTitle($item["context_sub_obj_id"]);
                 $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"] . "_" . $wptitle);
             } else {
                 if (in_array($item["context_obj_type"], array("frm")) && $item["context_sub_obj_type"] == "pos" && $item["context_sub_obj_id"] > 0) {
                     // frm hack, not nice
                     include_once "./Modules/Forum/classes/class.ilObjForumAccess.php";
                     $thread_id = ilObjForumAccess::_getThreadForPosting($item["context_sub_obj_id"]);
                     if ($thread_id > 0) {
                         $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"] . "_" . $thread_id . "_" . $item["context_sub_obj_id"]);
                     } else {
                         $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"]);
                     }
                 } else {
                     $feed_item->setLink(ILIAS_HTTP_PATH . "/goto.php?client_id=" . CLIENT_ID . "&amp;target=" . $item["context_obj_type"] . "_" . $item["ref_id"]);
                     //echo "<br>".ILIAS_HTTP_PATH."/goto.php?client_id=".CLIENT_ID.
                     //					"&amp;target=".$item["context_obj_type"]."_".$item["ref_id"];
                 }
             }
         }
         $feed_item->setAbout($feed_item->getLink() . "&amp;il_about_feed=" . $item["id"]);
         $feed_item->setDate($item["creation_date"]);
         // Enclosure
         if ($item["content_type"] == NEWS_AUDIO && $item["mob_id"] > 0 && ilObject::_exists($item["mob_id"])) {
             $go_on = true;
             if ($obj_type == "mcst") {
                 include_once "./Modules/MediaCast/classes/class.ilObjMediaCastAccess.php";
                 if (!ilObjMediaCastAccess::_lookupPublicFiles($obj_id)) {
                     $go_on = false;
                 }
             }
             if ($go_on) {
                 include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
                 $url = ilObjMediaObject::_lookupItemPath($item["mob_id"], true, true, $mob["purpose"]);
                 $file = ilObjMediaObject::_lookupItemPath($item["mob_id"], false, false, $mob["purpose"]);
                 if (is_file($file)) {
                     $size = filesize($file);
                 }
                 $feed_item->setEnclosureUrl($url);
                 $feed_item->setEnclosureType(isset($mob["format"]) ? $mob["format"] : "audio/mpeg");
                 $feed_item->setEnclosureLength($size);
             }
         }
         $this->addItem($feed_item);
     }
 }
Example #8
0
 /**
  * deletes a user
  * @access	public
  * @param	integer		user_id
  */
 function delete()
 {
     global $rbacadmin, $ilDB;
     // deassign from ldap groups
     include_once 'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php';
     $mapping = ilLDAPRoleGroupMapping::_getInstance();
     $mapping->deleteUser($this->getId());
     // remove mailbox / update sent mails
     include_once "Services/Mail/classes/class.ilMailbox.php";
     $mailbox = new ilMailbox($this->getId());
     $mailbox->delete();
     $mailbox->updateMailsOfDeletedUser($this->getLogin());
     // delete feed blocks on personal desktop
     include_once "./Services/Block/classes/class.ilCustomBlock.php";
     $costum_block = new ilCustomBlock();
     $costum_block->setContextObjId($this->getId());
     $costum_block->setContextObjType("user");
     $c_blocks = $costum_block->queryBlocksForContext();
     include_once "./Services/Feeds/classes/class.ilPDExternalFeedBlock.php";
     foreach ($c_blocks as $c_block) {
         if ($c_block["type"] == "pdfeed") {
             $fb = new ilPDExternalFeedBlock($c_block["id"]);
             $fb->delete();
         }
     }
     // delete block settings
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     ilBlockSetting::_deleteSettingsOfUser($this->getId());
     // delete user_account
     $ilDB->manipulateF("DELETE FROM usr_data WHERE usr_id = %s", array("integer"), array($this->getId()));
     // delete user_prefs
     ilObjUser::_deleteAllPref($this->getId());
     // delete user_session
     include_once "./Services/Authentication/classes/class.ilSession.php";
     ilSession::_destroyByUserId($this->getId());
     // remove user from rbac
     $rbacadmin->removeUser($this->getId());
     // remove bookmarks
     // TODO: move this to class.ilBookmarkFolder
     $q = "DELETE FROM bookmark_tree WHERE tree = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($q);
     $q = "DELETE FROM bookmark_data WHERE user_id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($q);
     // DELETE FORUM ENTRIES (not complete in the moment)
     include_once './Modules/Forum/classes/class.ilObjForum.php';
     ilObjForum::_deleteUser($this->getId());
     // Delete link check notify entries
     include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
     ilLinkCheckNotify::_deleteUser($this->getId());
     // Delete crs entries
     include_once './Modules/Course/classes/class.ilObjCourse.php';
     ilObjCourse::_deleteUser($this->getId());
     // Delete user tracking
     include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
     ilObjUserTracking::_deleteUser($this->getId());
     include_once 'Modules/Session/classes/class.ilEventParticipants.php';
     ilEventParticipants::_deleteByUser($this->getId());
     // Delete Tracking data SCORM 2004 RTE
     include_once 'Modules/Scorm2004/classes/ilSCORM13Package.php';
     ilSCORM13Package::_removeTrackingDataForUser($this->getId());
     // Delete Tracking data SCORM 1.2 RTE
     include_once 'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
     ilObjSCORMLearningModule::_removeTrackingDataForUser($this->getId());
     // remove all notifications
     include_once "./Services/Notification/classes/class.ilNotification.php";
     ilNotification::removeForUser($this->getId());
     // remove portfolios
     include_once "./Modules/Portfolio/classes/class.ilObjPortfolio.php";
     ilObjPortfolio::deleteUserPortfolios($this->getId());
     // remove workspace
     include_once "./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
     $tree = new ilWorkspaceTree($this->getId());
     $tree->cascadingDelete();
     // remove disk quota entries
     include_once "./Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
     ilDiskQuotaHandler::deleteByOwner($this->getId());
     // Delete user defined field entries
     $this->deleteUserDefinedFieldEntries();
     // Delete clipboard entries
     $this->clipboardDeleteAll();
     // Reset owner
     $this->resetOwner();
     // Trigger deleteUser Event
     global $ilAppEventHandler;
     $ilAppEventHandler->raise('Services/User', 'deleteUser', array('usr_id' => $this->getId()));
     // delete object data
     parent::delete();
     return true;
 }
 /**
  * Write side to database.
  *
  */
 public static function _writeSide($a_type, $a_value, $a_user = 0, $a_block_id = 0)
 {
     ilBlockSetting::_write($a_type, "side", $a_value, $a_user, $a_block_id);
 }
 /**
  * delete object and all related data	
  *
  * @access	public
  * @return	boolean	true if all object data were removed; false if only a references were removed
  */
 function delete()
 {
     // always call parent delete function first!!
     if (!parent::delete()) {
         return false;
     }
     //put here your module specific stuff
     // delete feed block
     include_once "./Services/Block/classes/class.ilCustomBlock.php";
     $costum_block = new ilCustomBlock();
     $costum_block->setContextObjId($this->getId());
     $costum_block->setContextObjType($this->getType());
     $c_blocks = $costum_block->queryBlocksForContext();
     include_once "./Services/Block/classes/class.ilExternalFeedBlock.php";
     foreach ($c_blocks as $c_block) {
         if ($c_block["type"] == "feed") {
             $fb = new ilExternalFeedBlock($c_block["id"]);
             $fb->delete();
             include_once "./Services/Block/classes/class.ilBlockSetting.php";
             ilBlockSetting::_deleteSettingsOfBlock($c_block["id"], "feed");
         }
     }
     //ilBlockSetting::_lookupSide($type, $user_id, $c_block["id"]);
     return true;
 }
 /**
  * Standard Version of Fill Row. Most likely to
  * be overwritten by derived class.
  */
 protected function fillRow($a_set)
 {
     global $lng, $ilCtrl;
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     // context
     $obj_id = ilObject::_lookupObjId($a_set["ref_id"]);
     $obj_type = ilObject::_lookupType($obj_id);
     $obj_title = ilObject::_lookupTitle($obj_id);
     // user
     if ($a_set["user_id"] > 0) {
         $this->tpl->setCurrentBlock("user_info");
         if ($obj_type == "frm") {
             include_once "./Modules/Forum/classes/class.ilForumProperties.php";
             if (ilForumProperties::_isAnonymized($a_set["context_obj_id"])) {
                 if ($a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) {
                     include_once "./Modules/Forum/classes/class.ilForumPost.php";
                     $post = new ilForumPost($a_set["context_sub_obj_id"]);
                     if ($post->getUserAlias() != "") {
                         $this->tpl->setVariable("VAL_AUTHOR", ilUtil::stripSlashes($post->getUserAlias()));
                     } else {
                         $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous"));
                     }
                 } else {
                     $this->tpl->setVariable("VAL_AUTHOR", $lng->txt("forums_anonymous"));
                 }
             } else {
                 if (ilObject::_exists($a_set["user_id"])) {
                     $user_obj = new ilObjUser($a_set["user_id"]);
                     $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
                 }
             }
         } else {
             if (ilObject::_exists($a_set["user_id"])) {
                 $user_obj = new ilObjUser($a_set["user_id"]);
                 $this->tpl->setVariable("VAL_AUTHOR", $user_obj->getLogin());
             }
         }
         $this->tpl->setVariable("TXT_AUTHOR", $lng->txt("author"));
         $this->tpl->parseCurrentBlock();
     }
     // media player
     if ($a_set["content_type"] == NEWS_AUDIO && $a_set["mob_id"] > 0 && ilObject::_exists($a_set["mob_id"])) {
         include_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
         include_once "./Services/MediaObjects/classes/class.ilMediaPlayerGUI.php";
         $mob = new ilObjMediaObject($a_set["mob_id"]);
         $med = $mob->getMediaItem("Standard");
         $mpl = new ilMediaPlayerGUI();
         $mpl->setFile(ilObjMediaObject::_getDirectory($a_set["mob_id"]) . "/" . $med->getLocation());
         $this->tpl->setCurrentBlock("player");
         $this->tpl->setVariable("PLAYER", $mpl->getMp3PlayerHtml());
         $this->tpl->parseCurrentBlock();
     }
     // access
     if ($enable_internal_rss) {
         $this->tpl->setCurrentBlock("access");
         include_once "./Services/Block/classes/class.ilBlockSetting.php";
         $this->tpl->setVariable("TXT_ACCESS", $lng->txt("news_news_item_visibility"));
         if ($a_set["visibility"] == NEWS_PUBLIC || $a_set["priority"] == 0 && ilBlockSetting::_lookup("news", "public_notifications", 0, $obj_id)) {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_public"));
         } else {
             $this->tpl->setVariable("VAL_ACCESS", $lng->txt("news_visibility_users"));
         }
         $this->tpl->parseCurrentBlock();
     }
     // content
     if ($a_set["content"] != "") {
         $this->tpl->setCurrentBlock("content");
         $this->tpl->setVariable("VAL_CONTENT", ilUtil::makeClickable($a_set["content"], true));
         $this->tpl->parseCurrentBlock();
     }
     if ($a_set["content_long"] != "") {
         $this->tpl->setCurrentBlock("long");
         $this->tpl->setVariable("VAL_LONG_CONTENT", ilUtil::makeClickable($a_set["content_long"], true));
         $this->tpl->parseCurrentBlock();
     }
     if ($a_set["update_date"] != $a_set["creation_date"]) {
         $this->tpl->setCurrentBlock("ni_update");
         $this->tpl->setVariable("TXT_LAST_UPDATE", $lng->txt("last_update"));
         $this->tpl->setVariable("VAL_LAST_UPDATE", ilDatePresentation::formatDate(new ilDateTime($a_set["update_date"], IL_CAL_DATETIME)));
         $this->tpl->parseCurrentBlock();
     }
     // forum hack, not nice
     $add = "";
     if ($obj_type == "frm" && $a_set["context_sub_obj_type"] == "pos" && $a_set["context_sub_obj_id"] > 0) {
         include_once "./Modules/Forum/classes/class.ilObjForumAccess.php";
         $pos = $a_set["context_sub_obj_id"];
         $thread = ilObjForumAccess::_getThreadForPosting($pos);
         if ($thread > 0) {
             $add = "_" . $thread . "_" . $pos;
         }
     }
     $url_target = "./goto.php?client_id=" . rawurlencode(CLIENT_ID) . "&target=" . $obj_type . "_" . $a_set["ref_id"] . $add;
     $this->tpl->setCurrentBlock("context");
     $cont_loc = new ilLocatorGUI();
     $cont_loc->addContextItems($a_set["ref_id"], true);
     $this->tpl->setVariable("CONTEXT_LOCATOR", $cont_loc->getHTML());
     $this->tpl->setVariable("HREF_CONTEXT_TITLE", $url_target);
     $this->tpl->setVariable("CONTEXT_TITLE", $obj_title);
     $this->tpl->setVariable("ALT_CONTEXT_TITLE", $lng->txt("icon") . " " . $lng->txt("obj_" . $obj_type));
     $this->tpl->setVariable("IMG_CONTEXT_TITLE", ilUtil::getImagePath("icon_" . $obj_type . "_b.png"));
     $this->tpl->parseCurrentBlock();
     $this->tpl->setVariable("HREF_TITLE", $url_target);
     // title
     if ($a_set["content_is_lang_var"]) {
         $this->tpl->setVariable("VAL_TITLE", $lng->txt($a_set["title"]));
     } else {
         $this->tpl->setVariable("VAL_TITLE", ilUtil::stripSlashes($a_set["title"]));
         // title
     }
     // creation date
     $this->tpl->setVariable("VAL_CREATION_DATE", ilDatePresentation::formatDate(new ilDateTime($a_set["creation_date"], IL_CAL_DATETIME)));
     $this->tpl->setVariable("TXT_CREATED", $lng->txt("created"));
     $this->tpl->parseCurrentBlock();
 }
 /**
  * Save settings.
  */
 function saveSettings()
 {
     global $ilCtrl, $ilUser;
     $news_set = new ilSetting("news");
     $enable_internal_rss = $news_set->get("enable_rss_for_internal");
     ilBlockSetting::_write($this->getBlockType(), "news_pd_period", $_POST["news_pd_period"], $ilUser->getId(), $this->block_id);
     include_once "./Services/News/classes/class.ilNewsCache.php";
     $cache = new ilNewsCache();
     $cache->deleteEntry($ilUser->getId() . ":0");
     $ilCtrl->returnToParent($this);
 }
 /**
  * show desktop
  */
 function show()
 {
     // preload block settings
     include_once "Services/Block/classes/class.ilBlockSetting.php";
     ilBlockSetting::preloadPDBlockSettings();
     // add template for content
     $this->pd_tpl = new ilTemplate("tpl.usr_personaldesktop.html", true, true, "Services/PersonalDesktop");
     $this->tpl->getStandardTemplate();
     // display infopanel if something happened
     ilUtil::infoPanel();
     //$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
     //	$this->lng->txt("personal_desktop"));
     //		$this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"),
     //			"");
     $this->tpl->setTitle($this->lng->txt("overview"));
     $this->tpl->setVariable("IMG_SPACE", ilUtil::getImagePath("spacer.png", false));
     $this->tpl->setContent($this->getCenterColumnHTML());
     $this->tpl->setRightContent($this->getRightColumnHTML());
     $this->tpl->setLeftContent($this->getLeftColumnHTML());
     if (count($this->action_menu->getItems())) {
         /**
          * @var $tpl ilTemplate
          * @var $lng ilLanguage
          */
         global $tpl, $lng;
         $this->action_menu->setAsynch(false);
         $this->action_menu->setAsynchUrl('');
         $this->action_menu->setListTitle($lng->txt('actions'));
         $this->action_menu->setId('act_pd');
         $this->action_menu->setSelectionHeaderClass('small');
         $this->action_menu->setItemLinkClass('xsmall');
         $this->action_menu->setLinksMode('il_ContainerItemCommand2');
         $this->action_menu->setHeaderIcon(ilAdvancedSelectionListGUI::DOWN_ARROW_DARK);
         $this->action_menu->setUseImages(false);
         $htpl = new ilTemplate('tpl.header_action.html', true, true, 'Services/Repository');
         $htpl->setVariable('ACTION_DROP_DOWN', $this->action_menu->getHTML());
         $tpl->setHeaderActionMenu($htpl->get());
     }
     $this->tpl->show();
 }
 /**
  * Import record
  *
  * @param
  * @return
  */
 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
 {
     //echo $a_entity;
     //var_dump($a_rec);
     switch ($a_entity) {
         case "mcst":
             include_once "./Modules/MediaCast/classes/class.ilObjMediaCast.php";
             if ($new_id = $a_mapping->getMapping('Services/Container', 'objs', $a_rec['Id'])) {
                 $newObj = ilObjectFactory::getInstanceByObjId($new_id, false);
             } else {
                 $newObj = new ilObjMediaCast();
                 $newObj->setType("mcst");
                 $newObj->create(true);
             }
             $newObj->setTitle($a_rec["Title"]);
             $newObj->setDescription($a_rec["Description"]);
             $newObj->setDefaultAccess($a_rec["DefaultAccess"]);
             $newObj->setDownloadable($a_rec["Downloadable"]);
             $newObj->setPublicFiles($a_rec["PublicFiles"]);
             if ($a_schema_version == "5.0.0") {
                 $newObj->setOrder($a_rec["Sortmode"]);
                 $newObj->setViewMode($a_rec["Viewmode"]);
                 if ($a_rec["Order"]) {
                     $this->order[$newObj->getId()] = explode(";", $a_rec["Order"]);
                 }
                 include_once "./Services/Block/classes/class.ilBlockSetting.php";
                 ilBlockSetting::_write("news", "public_feed", $a_rec["PublicFeed"], 0, $newObj->getId());
                 ilBlockSetting::_write("news", "keep_rss_min", $a_rec["KeepRssMin"], 0, $newObj->getId());
             }
             $newObj->update(true);
             $this->current_obj = $newObj;
             $a_mapping->addMapping("Modules/MediaCast", "mcst", $a_rec["Id"], $newObj->getId());
             $a_mapping->addMapping("Services/News", "news_context", $a_rec["Id"] . ":mcst:0:", $newObj->getId() . ":mcst:0:");
             //var_dump($a_mapping->mappings["Services/News"]["news_context"]);
             break;
     }
 }
 /**
  * Stores the block sequence asynchronously
  */
 public function saveBlockSortingAsynch()
 {
     /**
      * @var $ilUser ilObjUser
      */
     global $ilUser;
     $response = new stdClass();
     $response->success = false;
     if (!isset($_POST[IL_COL_LEFT]['sequence']) && !isset($_POST[IL_COL_RIGHT]['sequence'])) {
         echo json_encode($response);
         return;
     }
     if (in_array($this->getColType(), array('pd'))) {
         $response->success = true;
         foreach (array(IL_COL_LEFT => (array) $_POST[IL_COL_LEFT]['sequence'], IL_COL_RIGHT => (array) $_POST[IL_COL_RIGHT]['sequence']) as $side => $blocks) {
             $i = 2;
             foreach ($blocks as $block) {
                 $bid = explode('_', $block);
                 ilBlockSetting::_writeNumber($bid[1], $i, $ilUser->getId(), $bid[2]);
                 ilBlockSetting::_writeSide($bid[1], $side, $ilUser->getId(), $bid[2]);
                 $i += 2;
             }
         }
     }
     echo json_encode($response);
     exit;
 }
Example #16
0
 public function createSettings()
 {
     // news settings (public notifications yes/no)
     include_once "./Services/News/classes/class.ilNewsItem.php";
     $default_visibility = ilNewsItem::_getDefaultVisibilityForRefId($_GET["ref_id"]);
     if ($default_visibility == "public") {
         ilBlockSetting::_write("news", "public_notifications", 1, 0, $this->getId());
     }
     return true;
 }
Example #17
0
 /**
  * Handle read/write current detail level.
  */
 function handleDetailLevel()
 {
     global $ilUser, $ilCtrl;
     // set/get detail level
     if ($this->detail_max > $this->detail_min) {
         include_once "Services/Block/classes/class.ilBlockSetting.php";
         if (isset($_GET[$this->getDetailParameter()])) {
             ilBlockSetting::_writeDetailLevel($this->getBlockType(), $_GET[$this->getDetailParameter()], $ilUser->getId(), $this->block_id);
             $this->setCurrentDetailLevel($_GET[$this->getDetailParameter()]);
             if ((int) $_GET[$this->getDetailParameter()] == 0) {
                 $ilCtrl->redirectByClass("ilcolumngui", "");
             }
         } else {
             $this->setCurrentDetailLevel(ilBlockSetting::_lookupDetailLevel($this->getBlockType(), $ilUser->getId(), $this->block_id));
         }
     }
 }
Example #18
0
 /**
  * Clone media cast
  *
  * @param int target ref_id
  * @param int copy id
  */
 public function cloneObject($a_target_id, $a_copy_id = 0)
 {
     global $ilDB, $ilUser, $ilias;
     $new_obj = parent::cloneObject($a_target_id, $a_copy_id);
     //copy online status if object is not the root copy object
     $cp_options = ilCopyWizardOptions::_getInstance($a_copy_id);
     if (!$cp_options->isRootNode($this->getRefId())) {
         $new_obj->setOnline($this->getOnline());
     }
     //$new_obj->setTitle($this->getTitle());
     $new_obj->setPublicFiles($this->getPublicFiles());
     $new_obj->setDownloadable($this->getDownloadable());
     $new_obj->setDefaultAccess($this->getDefaultAccess());
     $new_obj->setOrder($this->getOrder());
     $new_obj->setViewMode($this->getViewMode());
     $new_obj->update();
     include_once "./Services/Block/classes/class.ilBlockSetting.php";
     $pf = ilBlockSetting::_lookup("news", "public_feed", 0, $this->getId());
     $keeprss = (int) ilBlockSetting::_lookup("news", "keep_rss_min", 0, $this->getId());
     ilBlockSetting::_write("news", "public_feed", $pf, 0, $new_obj->getId());
     ilBlockSetting::_write("news", "keep_rss_min", $keeprss, 0, $new_obj->getId());
     // copy items
     $this->copyItems($new_obj);
     // copy order!?
     return $new_obj;
 }