protected function getCommentData($articleId) { $this->import('iPhoneExportDom'); $commentDao =& DAORegistry::getDAO('CommentDAO'); $comments = $commentDao->getRootCommentsBySubmissionId($articleId); $output = '<ojs> <article id="' . $articleId . '" /> <comments>'; foreach ($comments as $comment) { $output .= iPhoneExportDom::getCommentXML($comment); } $output .= '</comments> </ojs>'; return $output; }
function getCommentXML($comment) { $data = '<comment id="' . $comment->getCommentId() . '"> <title>' . htmlspecialchars($comment->getTitle()) . '</title> <body>' . htmlspecialchars($comment->getBody()) . '</body> <datePosted>' . $comment->getDatePosted() . '</datePosted> <authorName>' . $comment->getPosterName() . '</authorName> <authorEmail>' . $comment->getPosterEmail() . '</authorEmail> <children>'; if (is_array($comment->getChildren())) { foreach ($comment->getChildren() as $child) { $data .= iPhoneExportDom::getCommentXML($child); } } $data .= ' </children> </comment>'; return $data; }