Ejemplo n.º 1
0
 /**
  * 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 getDesignMessage($lang, $receiver, $user, $after, $before, $is_new)
 {
     if (isset($after->approved)) {
         $changes = array('album_id' => self::translateValue('album_id', $after->album_id), '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_EMAIL_' . ($after->approved ? 'APPROVED' : 'DECLINED') . '_MESSAGE');
     } else {
         // Get the changed fields
         $props = array('created_by', 'access', 'album_id', 'file_name', 'description');
         $changes = array();
         if (is_object($before) && is_object($after)) {
             $changes = PFObjectHelper::getDiff($before, $after, $props);
         }
         if (!count($changes)) {
             return false;
         }
         if (array_key_exists('album_id', $changes)) {
             $changes['album_id'] = self::translateValue('album_id', $changes['album_id']);
         }
         $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() . PFdesignsHelperRoute::getDesignRoute($after->id, $after->project_id, $after->album_id, '0'));
     $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 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;
 }
Ejemplo n.º 3
0
 /**
  * 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;
 }