protected function getNewComment() { $comment = new rtComment(); if ($this->getUser()->isAuthenticated()) { $this->getUser()->getGuardUser(); $comment->setAuthorName($this->getUser()->getGuardUser()->getFirstName() . ' ' . $this->getUser()->getGuardUser()->getLastName()); $comment->setAuthorEmail($this->getUser()->getGuardUser()->getEmailAddress()); } return $comment; }
/** * Notify the administrator about new classified * * @param rtComment $comment */ protected function notifyAdministrator($comment) { if (!sfConfig::has('app_rt_comment_moderation_email')) { return; } $from = $comment->getAuthorEmail(); $to = sfConfig::get('app_rt_comment_moderation_email', '*****@*****.**'); $subject = 'New comment requires activation!'; $body = sprintf('A new comment was created by %s (%s)', $comment->getAuthorName(), $comment->getAuthorEmail()) . ":\n\n"; $body .= '--' . "\n\n"; $body .= strip_tags($comment->getContent()) . "\n\n"; $body .= '--' . "\n\n"; $body .= 'Click here if you would like to activate this comment:' . "\n"; $body .= $this->generateUrl('rt_comment_enable', array('id' => $comment->getId()), true); $this->getMailer()->composeAndSend($from, $to, $subject, $body); }
protected function clearObjectCache(rtComment $rt_comment) { $cache_class = $rt_comment->getModel() . 'CacheToolkit'; if (class_exists($cache_class)) { call_user_func($cache_class . '::clearCache', $rt_comment->getObject()); } }