当前位置: 首页>>代码示例>>PHP>>正文


PHP Comment::update方法代码示例

本文整理汇总了PHP中Comment::update方法的典型用法代码示例。如果您正苦于以下问题:PHP Comment::update方法的具体用法?PHP Comment::update怎么用?PHP Comment::update使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Comment的用法示例。


在下文中一共展示了Comment::update方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: update

 public function update($id)
 {
     $this->commentRepository->findById($id);
     $val = $this->commentRepository->getEditForm($id);
     if (!$val->isValid()) {
         return Redirect::back()->with('errors', $val->getErrors())->withInput();
     }
     if (!$this->commentRepository->update($id, $val->getInputData())) {
         return Redirect::back()->with('errors', $this->commentRepository->errors())->withInput();
     }
     return Redirect::action('AdminCommentsController@index')->with('success', 'Updated');
 }
开发者ID:christiannwamba,项目名称:laravel-site,代码行数:12,代码来源:AdminCommentsController.php

示例2: edit_post

 public function edit_post()
 {
     $data = $this->data;
     //取得公用數據
     //基本post欄位
     $orderid_Num = $this->input->post('orderid_Num', TRUE);
     $paycheck_status_Num = $this->input->post('paycheck_status_Num', TRUE);
     $product_status_Num = $this->input->post('product_status_Num', TRUE);
     $receive_name_Str = $this->input->post('receive_name_Str', TRUE);
     $receive_phone_Str = $this->input->post('receive_phone_Str', TRUE);
     $receive_time_Str = $this->input->post('receive_time_Str');
     $receive_address_Str = $this->input->post('receive_address_Str');
     $receive_remark_Str = $this->input->post('receive_remark_Str', TRUE);
     $transport_id_Str = $this->input->post('transport_id_Str', TRUE);
     $sendtime_Str = $this->input->post('sendtime_Str', TRUE);
     $order_status_Num = $this->input->post('order_status_Num', TRUE);
     $content_Str = $this->input->post('content_Str', TRUE);
     //建構OrderShop物件,並且更新
     $OrderShop = new OrderShop();
     $OrderShop->construct(array('orderid_Num' => $orderid_Num, 'paycheck_status_Num' => $paycheck_status_Num, 'product_status_Num' => $product_status_Num, 'receive_name_Str' => $receive_name_Str, 'receive_phone_Str' => $receive_phone_Str, 'receive_time_Str' => $receive_time_Str, 'receive_address_Str' => $receive_address_Str, 'receive_remark_Str' => $receive_remark_Str, 'transport_id_Str' => $transport_id_Str, 'sendtime_Str' => $sendtime_Str, 'updatetime_Str' => '', 'order_status_Num' => $order_status_Num));
     $OrderShop->update(array('db_update_Arr' => array('paycheck_status', 'product_status', 'receive_name', 'receive_phone', 'receive_time', 'receive_address', 'receive_remark', 'transport_id', 'sendtime', 'updatetime', 'order_status')));
     if (!empty($content_Str)) {
         $Comment = new Comment();
         $Comment->construct(['uid_Num' => $data['User']->uid_Num, 'typename_Str' => 'order', 'id_Num' => $OrderShop->orderid_Num, 'content_Str' => $content_Str]);
         $Comment->update();
     }
     //送出成功訊息
     $this->load->model('Message');
     $this->Message->show(array('message' => '設定成功', 'url' => 'admin/shop/order_shop/order_shop/tablelist'));
 }
开发者ID:fansWoo,项目名称:win_the_world,代码行数:30,代码来源:Order_shop.php

示例3: edit_post

 public function edit_post()
 {
     $data = $this->data;
     //取得公用數據
     $orderid_Num = $this->input->post('orderid_Num', TRUE);
     //基本post欄位
     $pay_account_Str = $this->input->post('pay_account_Str', TRUE);
     $pay_name_Str = $this->input->post('pay_name_Str', TRUE);
     $pay_paytime_Str = $this->input->post('pay_paytime_Str', TRUE);
     $pay_remark_Str = $this->input->post('pay_remark_Str', TRUE);
     $content_Str = $this->input->post('content_Str', TRUE);
     if (!empty($pay_account_Str) && !empty($pay_name_Str) && !empty($pay_paytime_Str)) {
         //建構OrderShop物件,並且更新
         $OrderShop = new OrderShop();
         $OrderShop->construct(array('orderid_Num' => $orderid_Num, 'pay_account_Str' => $pay_account_Str, 'pay_name_Str' => $pay_name_Str, 'pay_paytime_Str' => $pay_paytime_Str, 'pay_remark_Str' => $pay_remark_Str, 'pay_status_Num' => 1));
         $OrderShop->update(array('db_update_Arr' => array('pay_account', 'pay_name', 'pay_paytime', 'pay_remark', 'pay_status')));
     }
     if (!empty($content_Str)) {
         $Comment = new Comment();
         $Comment->construct(['uid_Num' => $data['User']->uid_Num, 'typename_Str' => 'order', 'id_Num' => $orderid_Num, 'content_Str' => $content_Str]);
         $Comment->update();
     }
     //送出成功訊息
     $this->load->model('Message');
     $this->Message->show(array('message' => '設定成功', 'url' => 'admin/user/order_shop/order_shop/tablelist'));
 }
开发者ID:fansWoo,项目名称:win_the_world,代码行数:26,代码来源:Order_shop.php

示例4: executeUpdate

 public function executeUpdate($request)
 {
     $this->prepareUpdate();
     if ($this->getRequest()->getMethod() == sfRequest::POST) {
         $this->form->bind($request->getParameter('comment'));
         if ($this->form->isValid()) {
             $values = $this->form->getValues();
             Comment::update($this->form->getValues(), $this->getUser()->getUser());
         }
     }
     return $this->redirect($this->getRequest()->getReferer());
 }
开发者ID:amitesh-singh,项目名称:Enlightenment,代码行数:12,代码来源:actions.class.php

示例5: edit_post

 public function edit_post()
 {
     $picids_Arr = $this->input->post('picids_Arr');
     $picid_Num = $this->input->post('picid_Num');
     $classids_Arr = $this->input->post('classids_Arr');
     if (!empty($picid_Num)) {
         $PicObj = new PicObj();
         $PicObj->construct_db(array('db_where_Arr' => array('picid_Num' => $picid_Num)));
         $PicObj->class_ClassMetaList = new ObjList();
         $PicObj->class_ClassMetaList->construct_db(array('db_where_or_Arr' => array('classid' => $classids_Arr), 'db_from_Str' => 'class', 'model_name_Str' => 'ClassMeta', 'limitstart_Num' => 0, 'limitcount_Num' => 100));
         $PicObj->updatetime_DateTime = new DateTimeObj();
         $PicObj->updatetime_DateTime->construct();
         if (!empty($classids_Arr[0])) {
             $PicObj->upload_status_Num = 1;
         } else {
             $PicObj->upload_status_Num = 2;
         }
         $PicObj->update();
         if (!empty($comment_content_Str)) {
             $Comment = new Comment();
             $Comment->construct(['uid_Num' => $data['User']->uid_Num, 'typename_Str' => 'pic', 'id_Num' => $PicObj->picid_Num, 'content_Str' => $comment_content_Str]);
             $Comment->update();
         }
         $this->load->model('Message');
         $this->Message->show(array('message' => '設定成功', 'url' => 'admin/base/pic/pic/tablelist'));
     } else {
         if (!empty($picids_Arr)) {
             $PicObjList = new ObjList();
             $PicObjList->construct_db(['db_where_or_Arr' => ['picid' => $picids_Arr], 'model_name_Str' => 'PicObj', 'db_orderby_Arr' => [['prioritynum', 'DESC'], ['updatetime', 'DESC']], 'limitstart_Num' => 0, 'limitcount_Num' => 100]);
             if (!empty($classids_Arr)) {
                 foreach ($PicObjList->obj_Arr as $key => $value_PicObj) {
                     $value_PicObj->set('class_ClassMetaList', ['classids_Arr' => $classids_Arr], 'ClassMetaList');
                     // $value_PicObj->upload_status_Num = 1;
                     $value_PicObj->update();
                 }
             }
             $this->load->model('Message');
             $this->Message->show(array('message' => '設定成功', 'url' => 'admin/base/pic/pic/tablelist'));
         } else {
             $this->load->model('Message');
             $this->Message->show(array('message' => '未知的錯誤', 'url' => 'admin/base/pic/pic/tablelist'));
         }
     }
 }
开发者ID:fansWoo,项目名称:win_the_world,代码行数:44,代码来源:Pic.php

示例6: requireDefaultRecords

 /**
  * Migrates the old {@link PageComment} objects to {@link Comment}
  */
 public function requireDefaultRecords()
 {
     parent::requireDefaultRecords();
     if (DB::getConn()->hasTable('PageComment')) {
         $comments = DB::query("SELECT * FROM \"PageComment\"");
         if ($comments) {
             while ($pageComment = $comments->nextRecord()) {
                 // create a new comment from the older page comment
                 $comment = new Comment();
                 $comment->update($pageComment);
                 // set the variables which have changed
                 $comment->BaseClass = 'SiteTree';
                 $comment->URL = isset($pageComment['CommenterURL']) ? $pageComment['CommenterURL'] : "";
                 $comment->write();
             }
         }
         DB::alteration_message("Migrated PageComment to Comment", "changed");
         DB::getConn()->dontRequireTable('PageComment');
     }
 }
开发者ID:roed,项目名称:silverstripe-comments,代码行数:23,代码来源:Comment.php

示例7: testCommentInfo

 /**
  * 
  */
 public function testCommentInfo()
 {
     // make sure adding info to comment works
     $this->comment->info->test = 'test';
     $this->assertEquals('test', $this->comment->info->test);
     $this->comment->update();
     $test_comment = Comment::get($this->comment->id);
     $this->assertEquals($this->comment->info->test, $test_comment->info->test);
     unset($test_comment);
     // make sure construction works with info
     $new_comment = new Comment();
     $this->assertType('CommentInfo', $new_comment->info);
     $this->assertFalse($new_comment->info->is_key_set());
     $new_comment->info->test = 'test';
     $new_comment->insert();
     $this->assertTrue($new_comment->info->is_key_set());
     $test_comment = Comment::get($new_comment->id);
     $this->assertEquals($new_comment->info->test, $test_comment->info->test);
     $new_comment->delete();
     unset($test_comment);
 }
开发者ID:psaintlaurent,项目名称:Habari,代码行数:24,代码来源:commentTest.php

示例8: redirect

 static function admin_update_comment()
 {
     if (empty($_POST)) {
         redirect("/admin/?action=manage_comments");
     }
     $comment = new Comment($_POST['id']);
     if (!$comment->editable()) {
         show_403(__("Access Denied"), __("You do not have sufficient privileges to edit this comment.", "comments"));
     }
     $visitor = Visitor::current();
     $status = $visitor->group->can("edit_comment") ? $_POST['status'] : $comment->status;
     $created_at = $visitor->group->can("edit_comment") ? datetime($_POST['created_at']) : $comment->created_at;
     $comment->update($_POST['author'], $_POST['author_email'], $_POST['author_url'], $_POST['body'], $status, $created_at);
     if (isset($_POST['ajax'])) {
         exit("{ \"comment_id\": " . $_POST['id'] . ", \"comment_timestamp\": \"" . $created_at . "\" }");
     }
     if ($_POST['status'] == "spam") {
         Flash::notice(__("Comment updated."), "/admin/?action=manage_spam");
     } else {
         Flash::notice(_f("Comment updated. <a href=\"%s\">View Comment &rarr;</a>", array($comment->post->url() . "#comment_" . $comment->id), "comments"), "/admin/?action=manage_comments");
     }
 }
开发者ID:relisher,项目名称:chyrp,代码行数:22,代码来源:comments.php

示例9: die

$comment_text = $comment->_dbo->comment_text;
if (!Permissions::checkPermAndLevel('edit_comments', $comment->_dbo->user_id)) {
    die("Permission denied.");
}
?>

<div class="a_white_pane">
<h1 class="a_title">Edycja komentarza</h1>
</div>

<br />

<?php 
if (!empty($_POST['submit'])) {
    try {
        $comment->update($_POST['comment_title'], $_POST['comment_text']);
        if (!empty($ref)) {
            header("Location: " . $ref);
        }
        $pane = new HTML_MessagePane("upd", $action == "add" ? _ADMIN_GROUP_CREATED : _ADMIN_GROUP_UPDATED, "", "a_ok_pane", "a_ok_pane_hdr");
        $pane->show();
    } catch (Exception2 $e) {
        $pane = new HTML_MessagePane("upd", $e->getMessage(), $e->getDescription(), "a_fail_pane", "a_fail_pane_hdr");
        $pane->show();
    }
}
$form = new HTML_AdminForm("edit_comment_form", "Edycja komentarza", $session->addSID("edit_comment.php"));
$form->addHidden("ref", $ref);
$form->addHidden("cmid", $cmid);
$pane = new HTML_AdminFormPane("p1", "Komentarz");
$field = new HTML_TextField("comment_title", "Tytu³", "", 50, $comment_title);
开发者ID:BackupTheBerlios,项目名称:phphoto-svn,代码行数:31,代码来源:edit_comment.php

示例10: array

 $info = array();
 $info["page"] = $_POST['page'];
 $info["editedId"] = isset($_POST['editedId']) ? $_POST['editedId'] : -1;
 $info["page"] = substr($info["page"], strlen(__BASE_PATH__));
 $info["text"] = $_POST['text'];
 $info["referedComment"] = isset($_POST['comment']) ? $_POST['comment'] : 0;
 $pName = isset($_POST['product']) ? $_POST['product'] : "";
 $pVersion = isset($_POST['version']) ? $_POST['version'] : "";
 $fullUser = base64_encode($pName . "_" . $pVersion . "_user");
 $info["sessionUserName"] = $fullUser;
 $info["product"] = $pName;
 $info["version"] = $pVersion;
 $comment = new Comment($dbConnectionInfo, "", $fullUser);
 if ($info['editedId'] > 0) {
     // edit comment
     $result = $comment->update($info);
     if (isset($result['rows']) && $result['rows'] > 0) {
         echo "Comment edited !|" . $result['id'];
     } else {
         if (isset($result['rows'])) {
             echo "Comment not edited!";
         }
     }
 } else {
     // insert comment
     $result = $comment->insert($info);
     if ($result['rows'] > 0) {
         if (isset($ses->{$fullUser})) {
             $user = $ses->{$fullUser};
             $userEmail = $ses->{$fullUser}->email;
             $userName = $ses->{$fullUser}->userName;
开发者ID:aidanreilly,项目名称:documentation,代码行数:31,代码来源:comment.php

示例11: Comment

		}
		if ( !$comment->delete_rating() ) redirect();
		redirect("#comment".$comment->id);
		break;

	case "remove_comment":
	case "restore_comment":
		Login::access_action("admin");
		action_required_parameters("id");
		$comment = new Comment($_POST['id']);
		if (!$comment->id) {
			warning(_("This comment does not exist."));
			redirect();
		}
		$comment->removed = ($action=="remove_comment");
		$comment->update(["removed"]);
		redirect("#comment".$comment->id);
		break;

	default:
		warning(_("Unknown action"));
		redirect();
	}
}


// $is_propronent means only confirmed proponents
list($supporters, $proponents, $is_supporter, $is_proponent, $is_valid) = $proposal->supporters();


html_head(_("Proposal")." ".$proposal->id, true);
开发者ID:ppschweiz,项目名称:basisentscheid,代码行数:31,代码来源:proposal.php

示例12: testUpdateInvalidComment

 /**
  *test updating a Comment that doesn't exist
  *
  * @expectedException PDOException
  */
 public function testUpdateInvalidComment()
 {
     // create a Comment and try to update without actually inserting it
     $comment = new Comment(null, $this->trail->getTrailId(), $this->user->getUserId(), $this->VALID_BROWSER, $this->VALID_CREATEDATE, $this->VALID_IPADDRESS, $this->VALID_COMMENTPHOTO, $this->VALID_COMMENTPHOTOTYPE, $this->VALID_COMMENTTEXT);
     $comment->update($this->getPDO());
 }
开发者ID:jmsaul,项目名称:open-trails,代码行数:11,代码来源:comment-test.php

示例13: intval

//$l = Logger::start();
$msg = "";
if (isset($_POST['del'])) {
    $id = intval($_POST['did']);
    $d = Comment::delete($id);
    if ($d) {
        $msg = opmsg("Comment Deleted Successfully", "success");
        redirect_to('managecomments.php');
    } else {
        $msg = opmsg("Comment Not Deleted", "danger");
    }
}
if (isset($_POST['approve'])) {
    $id = intval($_POST['cid']);
    $data['allowed'] = 1;
    $d = Comment::update($id, $data);
    if ($d) {
        $msg = opmsg("Comment Approved Successfully", "success");
        redirect_to('managecomments.php');
    } else {
        $msg = opmsg("Comment Not Approved", "danger");
    }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
开发者ID:shubhamoy,项目名称:photolia,代码行数:31,代码来源:managecomments.php

示例14: update

 public function update(Comment $comment)
 {
     if (!$this->validate() | !$comment->validate()) {
         throw new ValidationException();
     }
     $db = DB::conn();
     try {
         $db->begin();
         $db->update('thread', array('title' => $this->title, 'category_id' => $this->category_id), array('id' => $this->id));
         $comment->update();
         $db->commit();
     } catch (PDOException $e) {
         if ($e->errorInfo[1] == self::ERR_CATEGORY) {
             throw new CategoryException();
         }
         $db->rollback();
     }
 }
开发者ID:rdaitan,项目名称:dc-board,代码行数:18,代码来源:thread.php

示例15: header

$user_id = filter_input(INPUT_POST, "user_id");
$thread_id = filter_input(INPUT_POST, "thread_id");
$text = filter_input(INPUT_POST, "text");
$action = $_SERVER['REQUEST_METHOD'];
if ($get_action = filter_input(INPUT_POST, "action")) {
    if ($user_id != $_SESSION['user_id']) {
        header("Location: /bbs/");
        exit;
    }
    $action = filter_input(INPUT_POST, "action");
}
switch ($action) {
    case 'UPDATE':
        //update comment
        $params = array('id' => $comment_id, 'text' => $text);
        $comment->update($params);
        header("Location: /bbs/view/threads?id=" . $thread_id);
        exit;
    case 'POST':
        //new comment
        $user_id = $_SESSION["user_id"];
        $params = array('user_id' => $user_id, 'thread_id' => $thread_id, 'text' => $text);
        $comment->add($params);
        header("Location: /bbs/view/threads?id=" . $thread_id);
        exit;
    case 'DELETE':
        print $comment_id;
        if ($comment_id) {
            //DELETE
            $comment->deleteRow($comment_id);
        }
开发者ID:nagamoto,项目名称:php_bbs,代码行数:31,代码来源:comments_receiver.php


注:本文中的Comment::update方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。