/** * 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 getTopicMessage($lang, $receiver, $user, $after, $before, $is_new) { // Get the changed fields $props = array('description', 'created_by', 'access'); $changes = array(); if (is_object($before) && is_object($after)) { $changes = PFObjectHelper::getDiff($before, $after, $props); } if ($is_new) { $changes = PFObjectHelper::toArray($after, $props); } $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD'); $format = $lang->_($txt_prefix . '_MESSAGE'); $changes = PFnotificationsHelper::formatChanges($lang, $changes); $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); $link = JRoute::_(JURI::root() . PFforumHelperRoute::getTopicRoute($after->id, $after->project_id)); $txt = sprintf($format, $receiver->name, $user->name, $changes, $link); $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer); 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 getRevisionMessage($lang, $receiver, $user, $after, $before, $is_new) { if (!$is_new) { if (isset($after->approved)) { $fields = array('title' => $after->title, 'file_name' => $after->file_name, 'file_size' => $after->file_size . 'kb', 'created_by' => $after->created_by, 'description' => $after->description); $format = $lang->_('COM_PROJECTFORK_DESIGN_REV_EMAIL_' . ($after->approved ? 'APPROVED' : 'DECLINED') . '_MESSAGE'); } else { return false; } } else { // Get the changed fields $fields = array('title' => $after->title, 'file_name' => $after->file_name, 'file_size' => $after->file_size . 'kb', 'description' => $after->description); $txt_prefix = 'COM_PROJECTFORK_DESIGN_REV_EMAIL_' . ($is_new ? 'NEW' : 'UPD'); $format = $lang->_($txt_prefix . '_MESSAGE'); } $album = self::getAlbumId($after->parent_id); $changes = PFnotificationsHelper::formatChanges($lang, $fields); $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); $link = JURI::base(false) . JRoute::_(PFdesignsHelperRoute::getDesignRoute($after->parent_id, $after->project_id, $album, $after->id)); $txt = sprintf($format, $receiver->name, $user->name, $changes, $link); $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer); return $txt; }
/** * Method to generate the email message 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 getMilestoneCompletedMessage($lang, $receiver, $user, $table) { // Get the changed fields $props = array('description', 'created_by', 'access', array('start_date', 'NE-SQLDATE'), array('end_date', 'NE-SQLDATE')); $changes = PFObjectHelper::toArray($table, $props); $txt_prefix = self::$prefix; $format = $lang->_($txt_prefix . '_MESSAGE_COMPLETED'); $changes = PFnotificationsHelper::formatChanges($lang, $changes); $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); $link = JRoute::_(JURI::root() . PFmilestonesHelperRoute::getMilestoneRoute($table->id, $table->project_id)); $txt = sprintf($format, $receiver->name, $user->name, $changes, $link); $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer); 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 getProjectMessage($lang, $receiver, $user, $after, $before, $is_new) { $txt_prefix = self::$prefix . '_' . ($is_new ? 'NEW' : 'UPD'); // Get the changed fields $props = array('description', 'catid', 'created_by', 'access', 'start_date', 'end_date'); $changes = array(); if (is_object($before) && is_object($after)) { $changes = PFObjectHelper::getDiff($before, $after, $props); } if (!count($changes)) { return false; } $format = $lang->_($txt_prefix . '_MESSAGE'); $changes = PFnotificationsHelper::formatChanges($lang, $changes); $footer = sprintf($lang->_('COM_PROJECTFORK_EMAIL_FOOTER'), JURI::root()); $link = JRoute::_(JURI::root() . PFprojectsHelperRoute::getDashboardRoute($after->id . ':' . $after->alias)); $txt = sprintf($format, $receiver->name, $user->name, $changes, $link); $txt = str_replace('\\n', "\n", $txt . "\n\n" . $footer); return $txt; }