예제 #1
0
 /**
  * Link check test 
  * @param
  * @return
  */
 public function testLinkCheck()
 {
     global $ilDB;
     include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
     $not = new ilLinkCheckNotify($ilDB);
     $not->setObjId(99999);
     $not->setUserId(13);
     $ret = $not->addNotifier();
     $this->assertEquals($ret, true);
     $status = ilLinkCheckNotify::_getNotifyStatus(13, 99999);
     $this->assertEquals($status, true);
     $notifiers = ilLinkCheckNotify::_getNotifiers(99999);
     $this->assertEquals($notifiers, array(13));
     $del = ilLinkCheckNotify::_deleteObject(99999);
     $this->assertEquals($del, true);
 }
 function linkChecker()
 {
     global $ilias, $ilUser, $tpl;
     $this->__initLinkChecker();
     $this->setTabs();
     $this->setContentSubTabs("link_check");
     require_once './Services/LinkChecker/classes/class.ilLinkCheckerTableGUI.php';
     $toolbar = new ilToolbarGUI();
     if ((bool) $ilias->getSetting('cron_web_resource_check')) {
         include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
         include_once 'Services/Form/classes/class.ilPropertyFormGUI.php';
         $chb = new ilCheckboxInputGUI($this->lng->txt('link_check_message_a'), 'link_check_message');
         $chb->setValue(1);
         $chb->setChecked((bool) ilLinkCheckNotify::_getNotifyStatus($ilUser->getId(), $this->object->getId()));
         $chb->setOptionTitle($this->lng->txt('link_check_message_b'));
         $toolbar->addInputItem($chb);
         $toolbar->addFormButton($this->lng->txt('save'), 'saveLinkCheck');
         $toolbar->setFormAction($this->ctrl->getLinkTarget($this, 'saveLinkCheck'));
     }
     $tgui = new ilLinkCheckerTableGUI($this, 'linkChecker');
     $tgui->setLinkChecker($this->link_checker_obj)->setRowHandler($this)->setRefreshButton($this->lng->txt('refresh'), 'refreshLinkCheck');
     return $tpl->setContent($tgui->prepareHTML()->getHTML() . $toolbar->getHTML());
 }
예제 #3
0
 function __sendMail()
 {
     global $ilUser;
     if (!count($notify = $this->__getNotifyLinks())) {
         // Nothing to do
         return true;
     }
     if (!$this->getMailStatus()) {
         return true;
     }
     include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
     $body = "";
     $obj_name = "";
     foreach (ilLinkCheckNotify::_getAllNotifiers($this->db) as $usr_id => $obj_ids) {
         if (!is_object($tmp_user =& ilObjectFactory::getInstanceByObjId($usr_id, false))) {
             $this->__appendLogMessage('LinkChecker: Cannot find user with id: ' . $usr_id);
             continue;
         }
         $counter = 0;
         foreach ($obj_ids as $obj_id) {
             if (!isset($notify[$obj_id])) {
                 continue;
             }
             ++$counter;
             switch ($this->__getType()) {
                 case 'webr':
                     $obj_name = $this->__txt($tmp_user->getLanguage(), 'obj_webr');
                     break;
                 case 'lm':
                 default:
                     $obj_name = $this->__txt($tmp_user->getLanguage(), 'lo');
                     break;
             }
             $body .= $obj_name . ': ' . $this->__getTitle($obj_id) . "\r\n";
             $body .= $this->__txt($tmp_user->getLanguage(), 'link_check_perma_link', "mail") . ": " . $this->createPermanentLink($obj_id, $usr_id, $this->__getType()) . " \r\n";
             $body .= $this->__txt($tmp_user->getLanguage(), "link_check_affected_links", "mail") . ":\r\n";
             // Print all invalid
             foreach ($notify[$obj_id] as $data) {
                 $body .= $data['url'] . "\r\n";
             }
             $body .= "\r\n";
         }
         if ($counter) {
             include_once "./Services/Notification/classes/class.ilSystemNotification.php";
             $ntf = new ilSystemNotification();
             $ntf->setLangModules(array("mail", "common"));
             $ntf->setSubjectLangId("link_check_subject");
             $ntf->setIntroductionLangId("link_check_introduction");
             $ntf->setReasonLangId("link_check_reason");
             $ntf->addAdditionalInfo("additional_info", $body, true);
             $ntf->sendMail(array($tmp_user->getId()));
             $this->__appendLogMessage('LinkChecker: Sent mail to ' . $tmp_user->getEmail());
         }
         $body = "";
     }
 }
예제 #4
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;
 }
 function __sendMail()
 {
     global $ilUser;
     if (!count($notify = $this->__getNotifyLinks())) {
         // Nothing to do
         return true;
     }
     if (!$this->getMailStatus()) {
         return true;
     }
     include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
     foreach (ilLinkCheckNotify::_getAllNotifiers($this->db) as $usr_id => $obj_ids) {
         if (!is_object($tmp_user =& ilObjectFactory::getInstanceByObjId($usr_id, false))) {
             $this->__appendLogMessage('LinkChecker: Cannot find user with id: ' . $usr_id);
             continue;
         }
         $counter = 0;
         foreach ($obj_ids as $obj_id) {
             if (!isset($notify[$obj_id])) {
                 continue;
             }
             ++$counter;
             switch ($this->__getType()) {
                 case 'webr':
                     $body .= $this->__txt($tmp_user->getLanguage(), 'obj_webr');
                     break;
                 case 'lm':
                 default:
                     $body .= $this->__txt($tmp_user->getLanguage(), 'lo');
                     break;
             }
             $body .= ': ';
             $body .= $this->__getTitle($obj_id) . "\r\n";
             // Print all invalid
             foreach ($notify[$obj_id] as $data) {
                 $body .= $data['url'] . "\r\n";
             }
             $body .= "\r\n";
         }
         if ($counter) {
             include_once "Services/Mail/classes/class.ilFormatMail.php";
             $umail = new ilFormatMail($tmp_user->getId());
             $subject = $this->__txt($tmp_user->getLanguage(), 'link_check_subject');
             $umail->sendMail($tmp_user->getLogin(), "", "", $subject, $body, array(), array("normal"));
             $this->__appendLogMessage('LinkChecker: Sent mail to ' . $tmp_user->getEmail());
         }
     }
 }
 /**
  * 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;
     }
     // delete items
     include_once './Modules/WebResource/classes/class.ilLinkResourceItems.php';
     ilLinkResourceItems::_deleteAll($this->getId());
     // Delete notify entries
     include_once './Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
     ilLinkCheckNotify::_deleteObject($this->getId());
     // delete meta data
     $this->deleteMetaData();
     return true;
 }