function _getMessageForUser(&$user, $message_type, $params) { $msg = ''; switch ($message_type) { case self::MESSAGE_ADDED: $monitoredItem = $this->_getMonitoredItemForUser($user, $params['parent']); $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_added_mail_body', array($params['path']->get($params['parent']), $user->getRealName(), $this->_url, $params['parent']->getId(), $params['item']->getTitle(), $monitoredItem->getId())); break; default: $msg .= parent::_getMessageForUser($user, $message_type, $params); break; } return $msg; }
function _getMessageForUser(&$user, $message_type, $params) { $msg = ''; $dpm = $this->_getPermissionsManager(); switch ($message_type) { case self::MESSAGE_MOVED: $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_mail_body_begin', array($params['item']->getTitle(), $user->getRealName(), $this->_url, $params['parent']->getId())); $msg .= " "; $need_sep = false; if ($dpm->userCanAccess($params['user_monitor'], $params['old_parent']->getId())) { $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_from', array($params['path']->get($params['old_parent']))); $need_sep = true; } if ($dpm->userCanAccess($params['user_monitor'], $params['parent']->getId())) { if ($need_sep) { $msg .= "\n "; } $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_to', array($params['path']->get($params['parent']))); } $monitoredItem = $this->_getMonitoredItemForUser($user, $params['item']); $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_mail_body_end', array($this->_url, $monitoredItem->getId())); break; case self::MESSAGE_MOVED_FROM: $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_from_mail_body_begin', array($params['path']->get($params['old_parent']), $user->getRealName(), $this->_url, $params['parent']->getId(), $params['item']->getTitle())); $msg .= " "; if ($dpm->userCanAccess($params['user_monitor'], $params['old_parent']->getId())) { $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_from', array($params['path']->get($params['old_parent']))); } if ($dpm->userCanAccess($params['user_monitor'], $params['parent']->getId())) { $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_to', array($params['path']->get($params['parent']))); } $monitoredItem = $this->_getMonitoredItemForUser($user, $params['old_parent']); $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_mail_body_end', array($this->_url, $monitoredItem->getId())); break; case self::MESSAGE_MOVED_TO: $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_from_mail_body_begin', array($params['path']->get($params['parent']), $user->getRealName(), $this->_url, $params['parent']->getId(), $params['item']->getTitle())); $msg .= " "; if ($dpm->userCanAccess($params['user_monitor'], $params['old_parent']->getId())) { $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_from', array($params['path']->get($params['old_parent']))); } if ($dpm->userCanAccess($params['user_monitor'], $params['parent']->getId())) { $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_to', array($params['path']->get($params['parent']))); } $monitoredItem = $this->_getMonitoredItemForUser($user, $params['parent']); $msg .= $GLOBALS['Language']->getText('plugin_docman', 'notifications_moved_mail_body_end', array($this->_url, $monitoredItem->getId())); break; default: $msg .= parent::_getMessageForUser($user, $message_type, $params); break; } return $msg; }