本文整理汇总了PHP中Comment::setBody方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::setBody方法的具体用法?PHP Comment::setBody怎么用?PHP Comment::setBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Comment
的用法示例。
在下文中一共展示了Comment::setBody方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: controlerJob
public function controlerJob($maincont)
{
if ($maincont->isLoggued()) {
/*$_POST["author"]="gg42";
$_POST["body"]="move Ur body4242";
$_POST["published"]="1";
$_POST["postid"]="2";
$_POST["id"]=3;
$_SESSION["backmod"]="comment";
$_SESSION["backact"]="admin";*/
if (isset($_POST["id"])) {
$p = new Comment($_POST["id"]);
$p->setAuthor($_POST["author"]);
$p->setBody($_POST["body"]);
//$p->setHour(date("h:i:s"));
//$p->setDate(date("Y-m-d"));
$p->setPublished($_POST["published"]);
$p->setPostid($_POST["postid"]);
}
$maincont->goModule("comment", "admin");
//$maincont->goModule($_SESSION["backmod"],$_SESSION["backact"]);
} else {
$maincont->goModule("admin", "loginform");
}
}
示例2: findCommentById
public function findCommentById($id)
{
$stmt = $this->dtb->prepare('SELECT * FROM comments WHERE postID = :pid');
$stmt->bindValue(':pid', $pid, PDO::PARAM_INT);
$stmt->execute();
$data = array();
$um = new PdoUserManager();
$pm = new PdoPostManager();
$d = $stmt->fetch(PDO::FETCH_OBJ);
$c = new Comment();
$c->setId($d->id);
$c->setBody($d->body);
//$c->setPost($pm->findPostById($d->postID));
$c->setUser($um->findUserById($d->userID));
$c->setPublicationDate($d->publicationDate);
$data[] = $c;
$stmt->closeCursor();
return $data;
}
示例3: execute
/**
* Save changes to comment.
* @return int the comment ID
*/
function execute()
{
$journal =& Request::getJournal();
$enableComments = $journal->getSetting('enableComments');
$commentDao =& DAORegistry::getDAO('CommentDAO');
$comment = $this->comment;
if (!isset($comment)) {
$comment = new Comment();
}
$user =& Request::getUser();
$comment->setTitle($this->getData('title'));
$comment->setBody($this->getData('body'));
if (($enableComments == COMMENTS_ANONYMOUS || $enableComments == COMMENTS_UNAUTHENTICATED) && (Request::getUserVar('anonymous') || $user == null)) {
$comment->setPosterName($this->getData('posterName'));
$comment->setPosterEmail($this->getData('posterEmail'));
$comment->setUser(null);
} else {
$comment->setPosterName($user->getFullName());
$comment->setPosterEmail($user->getEmail());
$comment->setUser($user);
}
$comment->setParentCommentId($this->parentId);
if (isset($this->comment)) {
$commentDao->updateComment($comment);
} else {
$comment->setSubmissionId($this->articleId);
$comment->setChildCommentCount(0);
$commentDao->insertComment($comment);
$this->commentId = $comment->getId();
}
return $this->commentId;
}
示例4: Comment
/**
* Creates and returns a submission comment object from a row
* @param $row array
* @return Comment object
*/
function &_returnCommentFromRow($row, $childLevels = 0)
{
$userDao =& DAORegistry::getDAO('UserDAO');
$comment = new Comment();
$comment->setId($row['comment_id']);
$comment->setSubmissionId($row['submission_id']);
$comment->setUser($userDao->getUser($row['user_id']), true);
$comment->setPosterIP($row['poster_ip']);
$comment->setPosterName($row['poster_name']);
$comment->setPosterEmail($row['poster_email']);
$comment->setTitle($row['title']);
$comment->setBody($row['body']);
$comment->setDatePosted($this->datetimeFromDB($row['date_posted']));
$comment->setDateModified($this->datetimeFromDB($row['date_modified']));
$comment->setParentCommentId($row['parent_comment_id']);
$comment->setChildCommentCount($row['num_children']);
if (!HookRegistry::call('CommentDAO::_returnCommentFromRow', array(&$comment, &$row, &$childLevels))) {
if ($childLevels > 0) {
$comment->setChildren($this->getCommentsByParentId($row['comment_id'], $childLevels - 1));
} else {
if ($childLevels == SUBMISSION_COMMENT_RECURSE_ALL) {
$comment->setChildren($this->getCommentsByParentId($row['comment_id'], SUBMISSION_COMMENT_RECURSE_ALL));
}
}
}
return $comment;
}
示例5: handleComment
protected function handleComment(&$username, &$password, &$articleId, &$title, &$body)
{
$userDAO = DAORegistry::getDAO('UserDAO');
$user = $userDAO->getUserByCredentials($username, $password);
if ($user == null) {
return 'ERROR_CREDENTIALS';
}
if ($title == null || $title == '' || $body == null || $body == '' || $articleId == null || $articleId == '') {
return 'ERROR_PARAMS';
}
if (DAORegistry::getDAO('PublishedArticleDAO')->getPublishedArticleByArticleId($articleId) == null) {
return 'ERROR_NO_ARTICLE';
}
$commentDao =& DAORegistry::getDAO('CommentDAO');
$comment = new Comment();
$comment->setSubmissionId($articleId);
$comment->setBody($body);
$comment->setTitle($title);
$comment->setUser($user);
$comment->setChildCommentCount(0);
$comment->setPosterName($user->getFullName());
$comment->setPosterEmail($user->getEmail());
$result = $commentDao->insertComment($comment);
echo (int) $result;
}
示例6: execute
/**
* Save changes to comment.
* @return int the comment ID
*/
function execute()
{
$conference =& Request::getConference();
$schedConf =& Request::getSchedConf();
$enableComments = $conference->getSetting('enableComments');
$commentsRequireRegistration = $conference->getSetting('commentsRequireRegistration');
$commentsAllowAnonymous = $conference->getSetting('commentsAllowAnonymous');
$commentDao =& DAORegistry::getDAO('CommentDAO');
$comment = $this->comment;
if (!isset($comment)) {
$comment = new Comment();
}
$user =& Request::getUser();
$comment->setTitle($this->getData('title'));
$comment->setBody($this->getData('body'));
if (($commentsAllowAnonymous || !$commentsRequireRegistration) && (Request::getUserVar('anonymous') || $user == null)) {
$comment->setPosterName($this->getData('posterName'));
$comment->setPosterEmail($this->getData('posterEmail'));
$comment->setUser(null);
} else {
$comment->setPosterName($user->getFullName());
$comment->setPosterEmail($user->getEmail());
$comment->setUser($user);
}
$comment->setParentCommentId($this->parentId);
if (isset($this->comment)) {
$commentDao->updateComment($comment);
} else {
$comment->setPaperId($this->paperId);
$comment->setChildCommentCount(0);
$commentDao->insertComment($comment);
$this->commentId = $comment->getId();
}
return $this->commentId;
}
示例7: importPendingEmailAsComment
function importPendingEmailAsComment(&$incoming_mail, &$project, &$user, &$mailbox, $page_id = '')
{
$parent = ProjectObjects::findById(!empty($page_id) ? $page_id : $incoming_mail->getParentId());
//EOF:mod 20120820
if (!instance_of($parent, 'ProjectObject')) {
// parent object does not exists
$incoming_mail->setState(INCOMING_MAIL_STATUS_PARENT_NOT_EXISTS);
$incoming_mail_save = $incoming_mail->save();
return new Error(incoming_mail_module_get_status_description(INCOMING_MAIL_STATUS_PARENT_NOT_EXISTS));
}
// if
if (!$mailbox->getAcceptAllRegistered() && instance_of($user, 'User') && !$parent->canComment($user)) {
// user cannot create comments to parent object
$incoming_mail->setState(INCOMING_MAIL_STATUS_USER_CANNOT_CREATE_COMMENT);
$incoming_mail_save = $incoming_mail->save();
return new Error(incoming_mail_module_get_status_description(INCOMING_MAIL_STATUS_USER_CANNOT_CREATE_COMMENT));
} else {
if (!$parent->can_have_comments || $parent->getIsLocked() || $parent->getState() < STATE_VISIBLE) {
// parent object can't have comments
$incoming_mail->setState(INCOMING_MAIL_STATUS_USER_CANNOT_CREATE_COMMENT);
$incoming_mail_save = $incoming_mail->save();
return new Error(incoming_mail_module_get_status_description(INCOMING_MAIL_STATUS_USER_CANNOT_CREATE_COMMENT));
}
// if
}
// if
$comment = new Comment();
$comment->log_activities = false;
$comment->setCreatedBy($user);
$comment->setCreatedOn($incoming_mail->getCreatedOn());
$comment->setProjectId($parent->getProjectId());
$comment->setState(STATE_VISIBLE);
$comment->setSource(OBJECT_SOURCE_EMAIL);
$comment->setVisibility($parent->getVisibility());
$comment->setParent($parent);
$body_content = '';
if (stripos($incoming_mail->getBody(), '-- REPLY ABOVE THIS LINE --') !== false) {
$body_content = substr($incoming_mail->getBody(), 0, strpos($incoming_mail->getBody(), '-- REPLY ABOVE THIS LINE --'));
} else {
$body_content = $incoming_mail->getBody();
}
$comment->setBody($body_content);
IncomingMailImporter::attachFilesToProjectObject($incoming_mail, $comment);
//$save = $comment->save();
$save = $comment->save(true);
if ($save && !is_error($save)) {
$activity = new NewCommentActivityLog();
$activity->log($comment, $user);
if (instance_of($user, 'User')) {
$parent->subscribe($user);
}
// if
$comment->ready();
//BOF:mod 20111110 #493
preg_match("/\\[CID(.*?)\\](.*)/is", $incoming_mail->getSubject(), $results);
if (count($results) > 0) {
$project = new Project($parent->getProjectId());
$variables = array('owner_company_name' => get_owner_company(), 'project_name' => $project->getName(), 'project_url' => $project->getOverviewUrl(), 'object_type' => $comment->getVerboseType(), 'object_name' => $comment->getName(), 'object_body' => $comment->getFormattedBody(), 'object_url' => $comment->getViewUrl(), 'comment_body' => $comment->getFormattedBody(), 'comment_url' => $comment->getViewUrl(), 'created_by_url' => $user->getViewUrl(), 'created_by_name' => $user->getDisplayName(), 'details_body' => '', 'comment_id' => $comment->getId());
$emailed_comment_id = $results[1];
$emailed_comment = new Comment($emailed_comment_id);
$emailed_comment_creator_id = $emailed_comment->getCreatedById();
$email_to = array();
$temp_user_id = $user->getId();
$temp_comment_id = $comment->getId();
$rows = db_execute_all("select user_id from " . TABLE_PREFIX . "assignments_action_request where comment_id='" . $emailed_comment_id . "' and marked_for_email='1'");
foreach ($rows as $row) {
if ($row['user_id'] != $temp_user_id) {
$email_to[] = new User($row['user_id']);
db_execute("insert into " . TABLE_PREFIX . "assignments_action_request (user_id, marked_for_email, selected_by_user_id, comment_id, date_added) values ('" . $row['user_id'] . "', '1', '" . $temp_user_id . "', '" . $temp_comment_id . "', now())");
}
}
$row = db_execute_one("select a.selected_by_user_id from " . TABLE_PREFIX . "assignments_action_request a where a.comment_id='" . $emailed_comment_id . "' and a.marked_for_email='1' and a.selected_by_user_id not in (select b.user_id from " . TABLE_PREFIX . "assignments_action_request b where b.comment_id='" . $emailed_comment_id . "' and b.marked_for_email='1') limit 0, 1");
if (!empty($row['selected_by_user_id'])) {
if ($row['selected_by_user_id'] != $temp_user_id) {
$email_to[] = new User($row['selected_by_user_id']);
db_execute("insert into " . TABLE_PREFIX . "assignments_action_request (user_id, marked_for_email, selected_by_user_id, comment_id, date_added) values ('" . $row['selected_by_user_id'] . "', '1', '" . $temp_user_id . "', '" . $temp_comment_id . "', now())");
}
}
//ApplicationMailer::send(array(new User($emailed_comment_creator_id)), 'resources/new_comment', $variables, $parent);
$attachments = null;
$object_attachments = $comment->getAttachments();
if ($object_attachments) {
$attachments = array();
foreach ($object_attachments as $object_attachment) {
$attachments[] = array('path' => $object_attachment->getFilePath(), 'name' => $object_attachment->getName(), 'mime_type' => $object_attachment->getMimeType());
}
}
ApplicationMailer::send($email_to, 'resources/new_comment', $variables, $parent, $attachments);
}
//EOF:mod 20111110 #493
if (!empty($page_id)) {
//$link = mysql_connect(DB_HOST, DB_USER, DB_PASS);
//mysql_select_db(DB_NAME, $link);
//mysql_query("insert into testing (date_added, content) values (now(), 'Page_id: " . $page_id . "')");
//mysql_close($link);
$task =& IncomingMailImporter::importPendingEmailToTaskList($incoming_mail, $project, $user, $page_id, $comment);
return $task;
} else {
return $comment;
}
//.........这里部分代码省略.........