/** * Method to generate the email subject * * @param object $lang Instance of the default user language * @param object $receiveer Instance of the the receiving user * @param object $user Instance of the user who made the change * @param object $after Instance of the item table after it was updated * @param object $before Instance of the item table before it was updated * @param boolean $is_new True if the item is new ($before will be null) * * @return string */ public static function getCommentSubject($lang, $receiver, $user, $after, $before, $is_new) { if (!$is_new) { return false; } list($component, $item) = explode('.', $after->context, 2); $class_name = 'PF' . str_replace('com_pf', '', $component) . 'NotificationsHelper'; $value = null; if (class_exists($class_name)) { $methods = get_class_methods($class_name); if (in_array('getItemName', $methods)) { $item = call_user_func(array($class_name, 'getItemName'), $after->context); } if (in_array('translateItem', $methods)) { $value = call_user_func_array(array($class_name, 'translateItem'), array($after->context, $after->item_id)); } } $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD'); $format = $lang->_($txt_prefix . '_SUBJECT_' . strtoupper($item)); $project = PFnotificationsHelper::translateValue('project_id', $after->project_id); if (!$value) { $value = PFnotificationsHelper::translateValue($item . '_id', $after->item_id); } if ($item != 'project') { $txt = sprintf($format, $project, $user->name, $value); } else { $txt = sprintf($format, $project, $user->name); } return $txt; }
/** * Method to generate the email subject * * @param object $lang Instance of the default user language * @param object $receiveer Instance of the the receiving user * @param object $user Instance of the user who made the change * @param object $after Instance of the item table after it was updated * @param object $before Instance of the item table before it was updated * @param boolean $is_new True if the item is new ($before will be null) * * @return string */ public static function getReplySubject($lang, $receiver, $user, $after, $before, $is_new) { if (!$is_new) { return false; } $txt_prefix = 'COM_PROJECTFORK_REPLY_EMAIL_' . ($is_new ? 'NEW' : 'UPD'); $format = $lang->_($txt_prefix . '_SUBJECT'); $project = PFnotificationsHelper::translateValue('project_id', $after->project_id); $topic = PFnotificationsHelper::translateValue('topic_id', $after->topic_id); $txt = sprintf($format, $project, $user->name, $topic); return $txt; }
/** * Method to generate the email subject * * @param object $lang Instance of the default user language * @param object $receiveer Instance of the the receiving user * @param object $user Instance of the user who made the change * @param object $after Instance of the item table after it was updated * @param object $before Instance of the item table before it was updated * @param boolean $is_new True if the item is new ($before will be null) * * @return string */ public static function getMilestoneSubject($lang, $receiver, $user, $after, $before, $is_new) { $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD'); $format = $lang->_($txt_prefix . '_SUBJECT'); $project = PFnotificationsHelper::translateValue('project_id', $after->project_id); $txt = sprintf($format, $project, $user->name, $after->title); return $txt; }
/** * Method to generate the email subject for completed milestones * * @param object $lang Instance of the default user language * @param object $receiveer Instance of the the receiving user * @param object $user Instance of the user who made the change * @param object $table Instance of the item table after it was updated * * @return string */ public static function getMilestoneCompletedSubject($lang, $receiver, $user, $table) { $txt_prefix = self::$prefix; $format = $lang->_($txt_prefix . '_SUBJECT_COMPLETED'); $project = PFnotificationsHelper::translateValue('project_id', $table->project_id); $txt = sprintf($format, $project, $user->name, $table->title); return $txt; }
/** * Method to generate the email subject * * @param object $lang Instance of the default user language * @param object $receiveer Instance of the the receiving user * @param object $user Instance of the user who made the change * @param object $after Instance of the item table after it was updated * @param object $before Instance of the item table before it was updated * @param boolean $is_new True if the item is new ($before will be null) * * @return string */ public static function getRevisionSubject($lang, $receiver, $user, $after, $before, $is_new) { if (!$is_new) { if (isset($after->approved)) { $format = $lang->_('COM_PROJECTFORK_DESIGN_REV_EMAIL_' . ($after->approved ? 'APPROVED' : 'DECLINED') . '_SUBJECT'); } else { return false; } } else { $txt_prefix = 'COM_PROJECTFORK_DESIGN_REV_EMAIL_' . ($is_new ? 'NEW' : 'UPD'); $format = $lang->_($txt_prefix . '_SUBJECT'); } $project = PFnotificationsHelper::translateValue('project_id', $after->project_id); $parent = self::translateValue('parent_id', $after->parent_id); $txt = sprintf($format, $project, $user->name, $parent); return $txt; }
/** * Method to generate the email message * * @param object $lang Instance of the default user language * @param object $receiveer Instance of the the receiving user * @param object $user Instance of the user who made the change * @param object $after Instance of the item table after it was updated * @param object $before Instance of the item table before it was updated * @param boolean $is_new True if the item is new ($before will be null) * * @return string */ public static function getAttachmentMessage($lang, $receiver, $user, $after, $before, $is_new) { if (!$is_new) { return false; } list($component, $item) = explode('.', $after->item_type, 2); $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD'); $class_name = 'PF' . str_replace('com_pf', '', $component) . 'NotificationsHelper'; $value = null; if (class_exists($class_name)) { $methods = get_class_methods($class_name); if (in_array('getItemName', $methods)) { $item = call_user_func(array($class_name, 'getItemName'), $after->context); } if (in_array('translateItem', $methods)) { $value = call_user_func_array(array($class_name, 'translateItem'), array($after->item_type, $after->item_id)); } } if (!$value) { $value = PFnotificationsHelper::translateValue($item . '_id', $after->item_id); } switch ($item) { case 'project': $link = PFprojectsHelperRoute::getDashboardRoute($after->project_id); break; default: $class_name = 'PF' . str_replace('com_pf', '', $component) . 'HelperRoute'; $method = 'get' . ucfirst($item) . 'Route'; $link = ''; if (class_exists($class_name)) { if (in_array($method, get_class_methods($class_name))) { $link = call_user_func_array(array($class_name, $method), array($after->item_id, $after->project_id)); } } break; } $format = $lang->_($txt_prefix . '_MESSAGE'); $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); $link = JRoute::_(JURI::root() . $link); $txt = sprintf($format, $receiver->name, $user->name, $value, $link); $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer); return $txt; }