Example #1
0
 /**
  * Process answer
  */
 function processAnswer()
 {
     global $ilUser, $ilDB, $lng, $ilPluginAdmin, $ilLog;
     parent::processAnswer();
     //
     // Send notifications to authors that want to be informed on blocked users
     //
     $parent_id = ilPageObject::lookupParentId((int) $_GET["page_id"], "lm");
     // is restriction mode set?
     include_once "./Modules/LearningModule/classes/class.ilObjContentObject.php";
     if (ilObjContentObject::_lookupRestrictForwardNavigation($parent_id)) {
         // check if user is blocked
         $id = ilUtil::stripSlashes($_POST["id"]);
         include_once "./Services/COPage/classes/class.ilPageQuestionProcessor.php";
         $as = ilPageQuestionProcessor::getAnswerStatus($id, $ilUser->getId());
         // get question information
         include_once "./Modules/TestQuestionPool/classes/class.ilAssQuestionList.php";
         $qlist = new ilAssQuestionList($ilDB, $lng, $ilPluginAdmin);
         $qlist->setParentObjId(0);
         $qlist->addFieldFilter("question_id", array($id));
         $qlist->load();
         $qdata = $qlist->getQuestionDataArray();
         // has the user been blocked?
         if ($as["try"] >= $qdata[$as["qst_id"]]["nr_of_tries"] && $qdata[$as["qst_id"]]["nr_of_tries"] > 0 && !$as["passed"]) {
             include_once "./Services/Notification/classes/class.ilNotification.php";
             $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_LM_BLOCKED_USERS, $parent_id);
             if (count($users) > 0) {
                 include_once "./Modules/LearningModule/classes/class.ilLMMailNotification.php";
                 $not = new ilLMMailNotification();
                 $not->setType(ilLMMailNotification::TYPE_USER_BLOCKED);
                 $not->setQuestionId($id);
                 $not->setRefId((int) $_GET["ref_id"]);
                 $not->setRecipients($users);
                 $not->send();
             }
         }
     }
 }
 public function __construct(ilNotificationConfig $baseNotification, ilObjUser $user)
 {
     $this->baseNotification = $baseNotification;
     $this->user = $user;
     $this->link = $this->baseNotification->getLink();
     $this->linktarget = $this->baseNotification->getLinktarget();
     $this->handlerParams = $this->baseNotification->getHandlerParams();
 }
Example #3
0
 static function sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment = null)
 {
     global $ilUser, $ilObjDataCache, $ilAccess;
     include_once "./Services/Notification/classes/class.ilNotification.php";
     include_once "./Modules/Wiki/classes/class.ilObjWiki.php";
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $wiki_id = $ilObjDataCache->lookupObjId($a_wiki_ref_id);
     $wiki = new ilObjWiki($a_wiki_ref_id, true);
     $page = new ilWikiPage($a_page_id);
     // #11138
     $ignore_threshold = $a_action == "comment";
     // 1st update will be converted to new - see below
     if ($a_action == "new") {
         return;
     }
     if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
         $users = ilNotification::getNotificationsForObject($a_type, $a_page_id, null, $ignore_threshold);
         $wiki_users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
         $users = array_merge($users, $wiki_users);
         if (!sizeof($users)) {
             return;
         }
         ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI_PAGE, $a_page_id, $users);
     } else {
         $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
         if (!sizeof($users)) {
             return;
         }
     }
     ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI, $wiki_id, $users, $a_page_id);
     // #15192 - should always be present
     if ($a_page_id) {
         include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
         $link = ILIAS_HTTP_PATH . "/" . ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle());
     } else {
         include_once "./Services/Link/classes/class.ilLink.php";
         $link = ilLink::_getLink($a_wiki_ref_id);
     }
     include_once "./Services/Mail/classes/class.ilMail.php";
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Language/classes/class.ilLanguageFactory.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     // see ilBlogPostingGUI::getSnippet()
     // see ilBlogPosting::getNotificationAbstract()
     include_once "Modules/Wiki/classes/class.ilWikiPageGUI.php";
     $pgui = new ilWikiPageGUI($page->getId());
     $pgui->setRawPageContent(true);
     $pgui->setAbstractOnly(true);
     $pgui->setFileDownloadLink(".");
     $pgui->setFullscreenLink(".");
     $pgui->setSourcecodeDownloadScript(".");
     $snippet = $pgui->showPage();
     $snippet = ilPageObject::truncateHTML($snippet, 500, "...");
     // making things more readable
     $snippet = str_replace('<br/>', "\n", $snippet);
     $snippet = str_replace('<br />', "\n", $snippet);
     $snippet = str_replace('</p>', "\n", $snippet);
     $snippet = str_replace('</div>', "\n", $snippet);
     $snippet = trim(strip_tags($snippet));
     // "fake" new (to enable snippet - if any)
     $current_version = array_shift($page->getHistoryEntries());
     $current_version = $current_version["nr"];
     if (!$current_version) {
         $a_type = ilNotification::TYPE_WIKI;
         $a_action = "new";
     }
     foreach (array_unique($users) as $idx => $user_id) {
         if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $a_wiki_ref_id)) {
             // use language of recipient to compose message
             $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
             $ulng->loadLanguageModule('wiki');
             $subject = sprintf($ulng->txt('wiki_change_notification_subject'), $wiki->getTitle(), $page->getTitle());
             $message = sprintf($ulng->txt('wiki_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
             if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
                 // update/delete
                 $message .= $ulng->txt('wiki_change_notification_page_body_' . $a_action) . ":\n\n";
                 $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
                 $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
                 $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n";
                 if ($snippet) {
                     $message .= "\n" . $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n";
                 }
                 // include comment/note text
                 if ($a_comment) {
                     $message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n";
                 }
                 $message .= "\n" . $ulng->txt('wiki_change_notification_page_link') . ": " . $link;
             } else {
                 // new
                 $message .= $ulng->txt('wiki_change_notification_body_' . $a_action) . ":\n\n";
                 $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
                 $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
                 $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
                 if ($snippet) {
                     $message .= $ulng->txt('content') . "\n" . "----------------------------------------\n" . $snippet . "\n" . "----------------------------------------\n\n";
                 }
                 $message .= $ulng->txt('wiki_change_notification_link') . ": " . $link;
             }
             $mail_obj = new ilMail(ANONYMOUS_USER_ID);
             $mail_obj->appendInstallationSignature(true);
             $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
         } else {
             unset($users[$idx]);
         }
     }
 }
 public function addHeaderAction($a_redraw = false)
 {
     global $ilUser, $ilAccess, $tpl, $lng, $ilCtrl;
     include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, "dcl", $this->ref_id, $this->obj_id);
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $ilCtrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     $lg = $dispatcher->initHeaderAction();
     //$lg->enableNotes(true);
     //$lg->enableComments(ilObjWiki::_lookupPublicNotes($this->getPageObject()->getParentId()), false);
     // notification
     if ($ilUser->getId() != ANONYMOUS_USER_ID && $this->object->getNotification() == 1) {
         include_once "./Services/Notification/classes/class.ilNotification.php";
         if (ilNotification::hasNotification(ilNotification::TYPE_DATA_COLLECTION, $ilUser->getId(), $this->obj_id)) {
             //Command Activate Notification
             $ilCtrl->setParameter($this, "ntf", 1);
             $lg->addCustomCommand($ilCtrl->getLinkTarget($this, "toggleNotification"), "dcl_notification_deactivate_dcl");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $lng->txt("dcl_notification_activated"));
         } else {
             //Command Deactivate Notification
             $ilCtrl->setParameter($this, "ntf", 2);
             $lg->addCustomCommand($ilCtrl->getLinkTarget($this, "toggleNotification"), "dcl_notification_activate_dcl");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $lng->txt("dcl_notification_deactivated"));
         }
         $ilCtrl->setParameter($this, "ntf", "");
     }
     if (!$a_redraw) {
         $tpl->setHeaderActionMenu($lg->getHeaderAction());
     } else {
         return $lg->getHeaderAction();
     }
     $tpl->setHeaderActionMenu($lg->getHeaderAction());
 }
 function addHeaderAction($a_redraw = false)
 {
     global $ilUser, $ilAccess;
     $wiki_id = $this->getPageObject()->getParentId();
     $page_id = $this->getPageObject()->getId();
     include_once "Services/Object/classes/class.ilCommonActionDispatcherGUI.php";
     $dispatcher = new ilCommonActionDispatcherGUI(ilCommonActionDispatcherGUI::TYPE_REPOSITORY, $ilAccess, "wiki", $_GET["ref_id"], $wiki_id);
     $dispatcher->setSubObject("wpg", $page_id);
     include_once "Services/Object/classes/class.ilObjectListGUI.php";
     ilObjectListGUI::prepareJSLinks($this->ctrl->getLinkTarget($this, "redrawHeaderAction", "", true), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "ilnotegui"), "", "", true, false), $this->ctrl->getLinkTargetByClass(array("ilcommonactiondispatchergui", "iltagginggui"), "", "", true, false));
     $lg = $dispatcher->initHeaderAction();
     $lg->enableNotes(true);
     $lg->enableComments(ilObjWiki::_lookupPublicNotes($wiki_id), false);
     // rating
     if (ilObjWiki::_lookupRating($wiki_id) && $this->getPageObject()->getRating() && $this->getPageObject()->old_nr == 0) {
         $lg->enableRating(true, $this->lng->txt("wiki_rate_page"), ilObjWiki::_lookupRatingCategories($wiki_id), array("ilcommonactiondispatchergui", "ilratinggui"));
     }
     // notification
     if ($ilUser->getId() != ANONYMOUS_USER_ID) {
         include_once "./Services/Notification/classes/class.ilNotification.php";
         if (ilNotification::hasNotification(ilNotification::TYPE_WIKI, $ilUser->getId(), $wiki_id)) {
             $this->ctrl->setParameter($this, "ntf", 1);
             $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_wiki");
             $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("wiki_notification_activated"));
         } else {
             $this->ctrl->setParameter($this, "ntf", 2);
             $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_wiki");
             if (ilNotification::hasNotification(ilNotification::TYPE_WIKI_PAGE, $ilUser->getId(), $page_id)) {
                 $this->ctrl->setParameter($this, "ntf", 3);
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_deactivate_page");
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_on.png"), $this->lng->txt("wiki_page_notification_activated"));
             } else {
                 $this->ctrl->setParameter($this, "ntf", 4);
                 $lg->addCustomCommand($this->ctrl->getLinkTarget($this), "wiki_notification_activate_page");
                 $lg->addHeaderIcon("not_icon", ilUtil::getImagePath("notification_off.png"), $this->lng->txt("wiki_notification_deactivated"));
             }
         }
         $this->ctrl->setParameter($this, "ntf", "");
     }
     if (!$a_redraw) {
         $this->tpl->setHeaderActionMenu($lg->getHeaderAction());
     } else {
         return $lg->getHeaderAction();
     }
 }
Example #6
0
 protected function sendNotifications()
 {
     global $ilUser;
     // recipients
     include_once "./Services/Notification/classes/class.ilNotification.php";
     $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_POLL, $this->object->getId(), null, true);
     if (!sizeof($users)) {
         return;
     }
     include_once "./Services/Notification/classes/class.ilSystemNotification.php";
     $ntf = new ilSystemNotification();
     $ntf->setLangModules(array("poll"));
     $ntf->setRefId($this->ref_id);
     if ($this->object->getNonAnonymous()) {
         $ntf->setChangedByUserId($ilUser->getId());
     }
     $ntf->setSubjectLangId('poll_vote_notification_subject');
     $ntf->setIntroductionLangId('poll_vote_notification_body');
     $ntf->setGotoLangId('poll_vote_notification_link');
     $ntf->setReasonLangId('poll_vote_notification_reason');
     $notified = $ntf->sendMail($users, null, "read");
     ilNotification::updateNotificationTime(ilNotification::TYPE_POLL, $this->object->getId(), $notified);
 }
 /**
  * @param      $a_action
  * @param      $a_table_id
  * @param null $a_record_id
  */
 public static function sendNotification($a_action, $a_table_id, $a_record_id = NULL)
 {
     global $ilUser, $ilAccess;
     // If coming from trash, never send notifications and don't load dcl Object
     if ($_GET['ref_id'] == SYSTEM_FOLDER_ID) {
         return;
     }
     $dclObj = new ilObjDataCollection($_GET['ref_id']);
     if ($dclObj->getNotification() != 1) {
         return;
     }
     $obj_table = ilDataCollectionCache::getTableCache($a_table_id);
     $obj_dcl = $obj_table->getCollectionObject();
     // recipients
     require_once './Services/Notification/classes/class.ilNotification.php';
     $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_DATA_COLLECTION, $obj_dcl->getId(), true);
     if (!sizeof($users)) {
         return;
     }
     ilNotification::updateNotificationTime(ilNotification::TYPE_DATA_COLLECTION, $obj_dcl->getId(), $users);
     //FIXME  $_GET['ref_id]
     require_once './Services/Link/classes/class.ilLink.php';
     $link = ilLink::_getLink($_GET['ref_id']);
     // prepare mail content
     // use language of recipient to compose message
     require_once './Services/Language/classes/class.ilLanguageFactory.php';
     // send mails
     require_once './Services/Mail/classes/class.ilMail.php';
     require_once './Services/User/classes/class.ilObjUser.php';
     require_once './Services/Language/classes/class.ilLanguageFactory.php';
     require_once './Services/User/classes/class.ilUserUtil.php';
     require_once './Services/User/classes/class.ilUserUtil.php';
     require_once './Modules/DataCollection/classes/class.ilDataCollectionTable.php';
     foreach (array_unique($users) as $idx => $user_id) {
         // the user responsible for the action should not be notified
         // FIXME  $_GET['ref_id]
         if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $_GET['ref_id'])) {
             // use language of recipient to compose message
             $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
             $ulng->loadLanguageModule('dcl');
             $subject = sprintf($ulng->txt('dcl_change_notification_subject'), $obj_dcl->getTitle());
             // update/delete
             $message = $ulng->txt("dcl_hello") . " " . ilObjUser::_lookupFullname($user_id) . ",\n\n";
             $message .= $ulng->txt('dcl_change_notification_dcl_' . $a_action) . ":\n\n";
             $message .= $ulng->txt('obj_dcl') . ": " . $obj_dcl->getTitle() . "\n\n";
             $message .= $ulng->txt('dcl_table') . ": " . $obj_table->getTitle() . "\n\n";
             $message .= $ulng->txt('dcl_record') . ":\n";
             $message .= "------------------------------------\n";
             if ($a_record_id) {
                 $record = ilDataCollectionCache::getRecordCache($a_record_id);
                 if (!$record->getTableId()) {
                     $record->setTableId($a_table_id);
                 }
                 //					$message .= $ulng->txt('dcl_record_id').": ".$a_record_id.":\n";
                 $t = "";
                 foreach ($record->getTable()->getVisibleFields() as $field) {
                     if ($record->getRecordField($field->getId())) {
                         $t .= $field->getTitle() . ": " . $record->getRecordField($field->getId())->getPlainText() . "\n";
                     }
                 }
                 $message .= $t . "\n";
             }
             $message .= "------------------------------------\n";
             $message .= $ulng->txt('dcl_changed_by') . ": " . $ilUser->getFullname() . " " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
             $message .= $ulng->txt('dcl_change_notification_link') . ": " . $link . "\n\n";
             $message .= $ulng->txt('dcl_change_why_you_receive_this_email');
             $mail_obj = new ilMail(ANONYMOUS_USER_ID);
             $mail_obj->appendInstallationSignature(true);
             $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
         } else {
             unset($users[$idx]);
         }
     }
 }
 /**
  * Get block HTML code.
  */
 function getHTML()
 {
     global $ilCtrl, $lng, $ilAccess, $ilUser;
     $this->poll_block->setRefId($this->getRefId());
     $this->may_write = $ilAccess->checkAccess("write", "", $this->getRefId());
     $this->has_content = $this->poll_block->hasAnyContent($ilUser->getId(), $this->getRefId());
     if (!$this->may_write && !$this->has_content) {
         return "";
     }
     $poll_obj = $this->poll_block->getPoll();
     $this->setTitle($poll_obj->getTitle());
     $this->setData(array($poll_obj));
     $ilCtrl->setParameterByClass($this->getRepositoryObjectGUIName(), "ref_id", $this->getRefId());
     if (!$this->poll_block->getMessage($ilUser->getId())) {
         // notification
         include_once "./Services/Notification/classes/class.ilNotification.php";
         if (ilNotification::hasNotification(ilNotification::TYPE_POLL, $ilUser->getId(), $this->poll_block->getPoll()->getId())) {
             $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $this->getRepositoryObjectGUIName()), "unsubscribe"), $lng->txt("poll_notification_unsubscribe"));
         } else {
             $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $this->getRepositoryObjectGUIName()), "subscribe"), $lng->txt("poll_notification_subscribe"));
         }
     }
     if ($this->may_write) {
         // edit
         $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $this->getRepositoryObjectGUIName()), "render"), $lng->txt("edit_content"));
         $this->addBlockCommand($ilCtrl->getLinkTargetByClass(array("ilrepositorygui", $this->getRepositoryObjectGUIName()), "edit"), $lng->txt("settings"));
         /* delete (#10993 - see ilBlockGUI)
         			$parent_id = $tree->getParentId($this->getRefId());			
         			$type = ilObject::_lookupType($parent_id, true);
         			$class = $objDefinition->getClassName($type);
         			if($class)
         			{
         				$class = "ilobj".strtolower($class)."gui";
         				$ilCtrl->setParameterByClass($class, "ref_id", $parent_id);		
         				$ilCtrl->setParameterByClass($class, "item_ref_id", $this->getRefId());	
         				$this->addBlockCommand(
         					$ilCtrl->getLinkTargetByClass($class, "delete"),
         					$lng->txt("delete"));	
         			}			 
         			*/
     }
     $ilCtrl->clearParametersByClass($this->getRepositoryObjectGUIName());
     return parent::getHTML();
 }
 /**
  * delete course and all related data
  *
  * @access	public
  * @return	boolean	true if all object data were removed; false if only a references were removed
  */
 function delete()
 {
     global $ilDB;
     // always call parent delete function first!!
     if (!parent::delete()) {
         return false;
     }
     // put here course specific stuff
     $ilDB->manipulate("DELETE FROM exc_data " . "WHERE obj_id = " . $ilDB->quote($this->getId(), "integer"));
     //$this->ilias->db->query($query);
     //$this->file_obj->delete();
     //$this->members_obj->delete();
     // remove all notifications
     include_once "./Services/Notification/classes/class.ilNotification.php";
     ilNotification::removeForObject(ilNotification::TYPE_EXERCISE_SUBMISSION, $this->getId());
     return true;
 }
Example #10
0
 /**
  * delete wiki page and al related data	
  *
  * @access	public
  */
 function delete()
 {
     global $ilDB;
     // get other pages that link to this page
     $linking_pages = ilWikiPage::getLinksToPage($this->getWikiId(), $this->getId());
     // delete internal links information to this page
     include_once "./Services/COPage/classes/class.ilInternalLink.php";
     ilInternalLink::_deleteAllLinksToTarget("wpg", $this->getId());
     include_once "./Services/Notification/classes/class.ilNotification.php";
     ilWikiUtil::sendNotification("delete", ilNotification::TYPE_WIKI_PAGE, $this->getWikiRefId(), $this->getId());
     // remove all notifications
     include_once "./Services/Notification/classes/class.ilNotification.php";
     ilNotification::removeForObject(ilNotification::TYPE_WIKI_PAGE, $this->getId());
     // delete record of table il_wiki_data
     $query = "DELETE FROM il_wiki_page" . " WHERE id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($query);
     // delete co page
     parent::delete();
     // make links of other pages to this page a missing link
     foreach ($linking_pages as $lp) {
         $ilDB->manipulateF("DELETE FROM il_wiki_missing_page " . " WHERE wiki_id = %s AND source_id = %s AND target_name = %s ", array("integer", "integer", "text"), array($this->getWikiId(), $lp["id"], $this->getTitle()));
         $ilDB->manipulateF("INSERT INTO il_wiki_missing_page " . "(wiki_id, source_id, target_name) VALUES " . "(%s,%s,%s)", array("integer", "integer", "text"), array($this->getWikiId(), $lp["id"], $this->getTitle()));
     }
     return true;
 }
Example #11
0
 static function sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment = null)
 {
     global $ilUser;
     // get blog object id (repository or workspace)
     if ($a_in_wsp) {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
         $tree = new ilWorkspaceTree($ilUser->getId());
         // owner of tree is irrelevant
         $blog_obj_id = $tree->lookupObjectId($a_blog_node_id);
         $access_handler = new ilWorkspaceAccessHandler($tree);
     } else {
         $blog_obj_id = ilObject::_lookupObjId($a_blog_node_id);
         $access_handler = null;
     }
     if (!$blog_obj_id) {
         return;
     }
     include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
     $posting = new ilBlogPosting($a_posting_id);
     // #11138
     $ignore_threshold = $a_action == "comment";
     // approval handling
     $admin_only = false;
     if (!$posting->isApproved()) {
         $blog = new self($blog_obj_id, false);
         if ($blog->hasApproval()) {
             switch ($a_action) {
                 case "update":
                     // un-approved posting was updated - no notifications
                     return;
                 case "new":
                     // un-approved posting was activated - admin-only notification
                     $admin_only = true;
                     $ignore_threshold = true;
                     break;
             }
         }
     }
     // recipients
     include_once "./Services/Notification/classes/class.ilNotification.php";
     $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_BLOG, $blog_obj_id, $a_posting_id, $ignore_threshold);
     if (!sizeof($users)) {
         return;
     }
     include_once "./Services/Notification/classes/class.ilSystemNotification.php";
     $ntf = new ilSystemNotification($a_in_wsp);
     $ntf->setLangModules(array("blog"));
     $ntf->setRefId($a_blog_node_id);
     $ntf->setChangedByUserId($ilUser->getId());
     $ntf->setSubjectLangId('blog_change_notification_subject');
     $ntf->setIntroductionLangId('blog_change_notification_body_' . $a_action);
     $ntf->addAdditionalInfo('blog_posting', $posting->getTitle());
     if ($a_comment) {
         $ntf->addAdditionalInfo('comment', $a_comment, true);
     }
     $ntf->setGotoLangId('blog_change_notification_link');
     $ntf->setReasonLangId('blog_change_notification_reason');
     $notified = $ntf->sendMail($users, "_" . $a_posting_id, $admin_only ? "write" : "read");
     ilNotification::updateNotificationTime(ilNotification::TYPE_BLOG, $blog_obj_id, $notified);
 }
Example #12
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;
 }
 static function sendNotification($a_action, $a_type, $a_wiki_ref_id, $a_page_id, $a_comment = null)
 {
     global $ilUser, $ilObjDataCache, $ilAccess;
     include_once "./Services/Notification/classes/class.ilNotification.php";
     include_once "./Modules/Wiki/classes/class.ilObjWiki.php";
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     $wiki_id = $ilObjDataCache->lookupObjId($a_wiki_ref_id);
     $wiki = new ilObjWiki($a_wiki_ref_id, true);
     $page = new ilWikiPage($a_page_id);
     // #11138
     $ignore_threshold = $a_action == "comment";
     if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
         $users = ilNotification::getNotificationsForObject($a_type, $a_page_id, null, $ignore_threshold);
         $wiki_users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
         $users = array_merge($users, $wiki_users);
         if (!sizeof($users)) {
             return;
         }
         include_once "./Modules/Wiki/classes/class.ilObjWikiGUI.php";
         $link = ILIAS_HTTP_PATH . "/" . ilObjWikiGui::getGotoLink($a_wiki_ref_id, $page->getTitle());
         ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI_PAGE, $a_page_id, $users);
     } else {
         $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_WIKI, $wiki_id, $a_page_id, $ignore_threshold);
         if (!sizeof($users)) {
             return;
         }
         include_once "./Services/Link/classes/class.ilLink.php";
         $link = ilLink::_getLink($a_wiki_ref_id);
     }
     ilNotification::updateNotificationTime(ilNotification::TYPE_WIKI, $wiki_id, $users, $a_page_id);
     include_once "./Services/Mail/classes/class.ilMail.php";
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Language/classes/class.ilLanguageFactory.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     foreach (array_unique($users) as $idx => $user_id) {
         if ($user_id != $ilUser->getId() && $ilAccess->checkAccessOfUser($user_id, 'read', '', $a_wiki_ref_id)) {
             // use language of recipient to compose message
             $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
             $ulng->loadLanguageModule('wiki');
             $subject = sprintf($ulng->txt('wiki_change_notification_subject'), $wiki->getTitle());
             $message = sprintf($ulng->txt('wiki_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
             if ($a_type == ilNotification::TYPE_WIKI_PAGE) {
                 // update/delete
                 $message .= $ulng->txt('wiki_change_notification_page_body_' . $a_action) . ":\n\n";
                 $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
                 $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
                 $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n";
                 // include comment/note text
                 if ($a_comment) {
                     $message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n";
                 }
                 $message .= "\n" . $ulng->txt('wiki_change_notification_page_link') . ": " . $link;
             } else {
                 // new
                 $message .= $ulng->txt('wiki_change_notification_body_' . $a_action) . ":\n\n";
                 $message .= $ulng->txt('wiki') . ": " . $wiki->getTitle() . "\n";
                 $message .= $ulng->txt('page') . ": " . $page->getTitle() . "\n";
                 $message .= $ulng->txt('wiki_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n\n";
                 $message .= $ulng->txt('wiki_change_notification_link') . ": " . $link;
             }
             $mail_obj = new ilMail(ANONYMOUS_USER_ID);
             $mail_obj->appendInstallationSignature(true);
             $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
         } else {
             unset($users[$idx]);
         }
     }
 }
Example #14
0
 /**
  * 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()
 {
     global $ilDB;
     // always call parent delete function first!!
     if (!parent::delete()) {
         return false;
     }
     // delete record of table il_wiki_data
     $query = "DELETE FROM il_wiki_data" . " WHERE id = " . $ilDB->quote($this->getId(), "integer");
     $ilDB->manipulate($query);
     // remove all notifications
     include_once "./Services/Notification/classes/class.ilNotification.php";
     ilNotification::removeForObject(ilNotification::TYPE_WIKI, $this->getId());
     include_once "./Modules/Wiki/classes/class.ilWikiPage.php";
     ilWikiPage::deleteAllPagesOfWiki($this->getId());
     return true;
 }
 /**
  * save properties
  */
 function saveProperties()
 {
     global $lng, $ilUser;
     $valid = false;
     $this->initPropertiesForm();
     if ($this->form->checkInput()) {
         include_once "./Services/Object/classes/class.ilObjectTranslation.php";
         $ot = ilObjectTranslation::getInstance($this->object->getId());
         if ($ot->getContentActivated()) {
             $ot->setDefaultTitle($_POST['title']);
             $ot->setDefaultDescription($_POST['description']);
             $ot->save();
         }
         $this->object->setTitle($_POST['title']);
         $this->object->setDescription($_POST['description']);
         $this->object->setLayout($_POST["lm_layout"]);
         $this->object->setPageHeader($_POST["lm_pg_header"]);
         $this->object->setTOCMode($_POST["toc_mode"]);
         $this->object->setOnline($_POST["cobj_online"]);
         $this->object->setActiveNumbering($_POST["cobj_act_number"]);
         $this->object->setCleanFrames($_POST["cobj_clean_frames"]);
         if (!$this->ilias->getSetting('disable_comments')) {
             $this->object->setPublicNotes($_POST["cobj_pub_notes"]);
         }
         $this->object->setHistoryUserComments($_POST["cobj_user_comments"]);
         $this->object->setLayoutPerPage($_POST["layout_per_page"]);
         $this->object->setRating($_POST["rating"]);
         $this->object->setRatingPages($_POST["rating_pages"]);
         $this->object->setDisableDefaultFeedback((int) $_POST["disable_def_feedback"]);
         $this->object->setProgressIcons((int) $_POST["progr_icons"]);
         $add_info = "";
         if ($_POST["restrict_forw_nav"] && !$_POST["store_tries"]) {
             $_POST["store_tries"] = 1;
             $add_info = "</br>" . $lng->txt("cont_automatically_set_store_tries");
             $add_info = str_replace("\$1", $lng->txt("cont_tries_store"), $add_info);
             $add_info = str_replace("\$2", $lng->txt("cont_restrict_forw_nav"), $add_info);
         }
         $this->object->setStoreTries((int) $_POST["store_tries"]);
         $this->object->setRestrictForwardNavigation((int) $_POST["restrict_forw_nav"]);
         $this->object->updateProperties();
         $this->object->update();
         include_once "./Services/Notification/classes/class.ilNotification.php";
         ilNotification::setNotification(ilNotification::TYPE_LM_BLOCKED_USERS, $ilUser->getId(), $this->object->getId(), (bool) $this->form->getInput("notification_blocked_users"));
         if ($this->object->getType() == 'lm') {
             // Update ecs export settings
             include_once 'Modules/LearningModule/classes/class.ilECSLearningModuleSettings.php';
             $ecs = new ilECSLearningModuleSettings($this->object);
             if ($ecs->handleSettingsUpdate()) {
                 $valid = true;
             }
         } else {
             $valid = true;
         }
     }
     if ($valid) {
         ilUtil::sendSuccess($this->lng->txt("msg_obj_modified") . $add_info, true);
         $this->ctrl->redirect($this, "properties");
     } else {
         $lng->loadLanguageModule("style");
         $this->setTabs("settings");
         $this->setSubTabs("cont_general_properties");
         $this->form->setValuesByPost();
         $this->tpl->setContent($this->form->getHTML());
     }
 }
 protected function setNotification()
 {
     global $ilUser, $ilCtrl;
     include_once "./Services/Notification/classes/class.ilNotification.php";
     switch ($_GET["ntf"]) {
         case 1:
             ilNotification::setNotification(ilNotification::TYPE_BLOG, $ilUser->getId(), $this->obj_id, false);
             break;
         case 2:
             ilNotification::setNotification(ilNotification::TYPE_BLOG, $ilUser->getId(), $this->obj_id, true);
             break;
     }
     $ilCtrl->redirect($this, "preview");
 }
Example #17
0
 /**
  * Send submission notifications
  * @param	int	$assignment_id
  */
 protected function sendNotifications($assignment_id)
 {
     include_once "./Services/Notification/classes/class.ilNotification.php";
     $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_EXERCISE_SUBMISSION, $this->object->getId());
     include_once "./Modules/Exercise/classes/class.ilExerciseMailNotification.php";
     $not = new ilExerciseMailNotification();
     $not->setType(ilExerciseMailNotification::TYPE_SUBMISSION_UPLOAD);
     $not->setAssignmentId($assignment_id);
     $not->setRefId($this->ref_id);
     $not->setRecipients($users);
     $not->send();
 }
 static function sendNotification($a_action, $a_in_wsp, $a_blog_node_id, $a_posting_id, $a_comment = null)
 {
     global $ilUser, $ilAccess;
     // get blog object id (repository or workspace)
     if ($a_in_wsp) {
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
         include_once "Services/PersonalWorkspace/classes/class.ilWorkspaceAccessHandler.php";
         $tree = new ilWorkspaceTree($ilUser->getId());
         // owner of tree is irrelevant
         $blog_obj_id = $tree->lookupObjectId($a_blog_node_id);
         $access_handler = new ilWorkspaceAccessHandler($tree);
         $link = ilWorkspaceAccessHandler::getGotoLink($a_blog_node_id, $blog_obj_id, "_" . $a_posting_id);
     } else {
         $blog_obj_id = ilObject::_lookupObjId($a_blog_node_id);
         $access_handler = null;
         include_once "Services/Link/classes/class.ilLink.php";
         $link = ilLink::_getStaticLink($a_blog_node_id, "blog", true, "_" . $a_posting_id);
     }
     if (!$blog_obj_id) {
         return;
     }
     include_once "./Modules/Blog/classes/class.ilBlogPosting.php";
     $posting = new ilBlogPosting($a_posting_id);
     // #11138
     $ignore_threshold = $a_action == "comment";
     // approval handling
     $admin_only = false;
     if (!$posting->isApproved()) {
         $blog = new self($blog_obj_id, false);
         if ($blog->hasApproval()) {
             switch ($a_action) {
                 case "update":
                     // un-approved posting was updated - no notifications
                     return;
                 case "new":
                     // un-approved posting was activated - admin-only notification
                     $admin_only = true;
                     $ignore_threshold = true;
                     break;
             }
         }
     }
     // recipients
     include_once "./Services/Notification/classes/class.ilNotification.php";
     $users = ilNotification::getNotificationsForObject(ilNotification::TYPE_BLOG, $blog_obj_id, $a_posting_id, $ignore_threshold);
     if (!sizeof($users)) {
         return;
     }
     // send mails
     include_once "./Services/Mail/classes/class.ilMail.php";
     include_once "./Services/User/classes/class.ilObjUser.php";
     include_once "./Services/Language/classes/class.ilLanguageFactory.php";
     include_once "./Services/User/classes/class.ilUserUtil.php";
     $posting_title = $posting->getTitle();
     $blog_title = ilObject::_lookupTitle($blog_obj_id);
     $author = $posting->getAuthor();
     $notified = array();
     foreach (array_unique($users) as $idx => $user_id) {
         // the user responsible for the action should not be notified
         if ($user_id == $ilUser->getId()) {
             continue;
         }
         // workspace
         if ($access_handler) {
             if ($admin_only && !$access_handler->checkAccessOfUser($tree, $user_id, 'write', '', $a_blog_node_id)) {
                 continue;
             }
             if (!$access_handler->checkAccessOfUser($tree, $user_id, 'read', '', $a_blog_node_id)) {
                 continue;
             }
         } else {
             if ($admin_only && !$ilAccess->checkAccessOfUser($user_id, 'write', '', $a_blog_node_id)) {
                 continue;
             }
             if (!$ilAccess->checkAccessOfUser($user_id, 'read', '', $a_blog_node_id)) {
                 continue;
             }
         }
         // use language of recipient to compose message
         $ulng = ilLanguageFactory::_getLanguageOfUser($user_id);
         $ulng->loadLanguageModule('blog');
         $subject = sprintf($ulng->txt('blog_change_notification_subject'), $blog_title);
         $message = sprintf($ulng->txt('blog_change_notification_salutation'), ilObjUser::_lookupFullname($user_id)) . "\n\n";
         $message .= $ulng->txt('blog_change_notification_body_' . $a_action) . ":\n\n";
         $message .= $ulng->txt('obj_blog') . ": " . $blog_title . "\n";
         $message .= $ulng->txt('blog_posting') . ": " . $posting_title . "\n";
         $message .= $ulng->txt('blog_changed_by') . ": " . ilUserUtil::getNamePresentation($ilUser->getId()) . "\n";
         if ($a_comment) {
             $message .= "\n" . $ulng->txt('comment') . ":\n\"" . trim($a_comment) . "\"\n";
         }
         $message .= "\n" . $ulng->txt('blog_change_notification_link') . ": " . $link;
         $mail_obj = new ilMail(ANONYMOUS_USER_ID);
         $mail_obj->appendInstallationSignature(true);
         $mail_obj->sendMail(ilObjUser::_lookupLogin($user_id), "", "", $subject, $message, array(), array("system"));
         $notified[] = $user_id;
     }
     if (sizeof($notified)) {
         ilNotification::updateNotificationTime(ilNotification::TYPE_BLOG, $blog_obj_id, $notified);
     }
 }