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


PHP comment::delete方法代码示例

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


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

示例1: delete

 function delete()
 {
     // delete all contacts and comments linked with this client as well
     $db = new db_alloc();
     $query = prepare("SELECT * FROM clientContact WHERE clientID=%d", $this->get_id());
     $db->query($query);
     while ($db->next_record()) {
         $clientContact = new clientContact();
         $clientContact->read_db_record($db);
         $clientContact->delete();
     }
     $query = prepare("SELECT * FROM comment WHERE commentType = 'client' and commentLinkID=%d", $this->get_id());
     $db->query($query);
     while ($db->next_record()) {
         $comment = new comment();
         $comment->read_db_record($db);
         $comment->delete();
     }
     return parent::delete();
 }
开发者ID:cjbayliss,项目名称:alloc,代码行数:20,代码来源:client.inc.php

示例2: test_data_comment_deleted_event

 /**
  * Test comment_deleted event.
  */
 public function test_data_comment_deleted_event()
 {
     global $CFG, $DB;
     require_once $CFG->dirroot . '/comment/lib.php';
     $this->resetAfterTest();
     // Create a record for deleting.
     $this->setAdminUser();
     $course = $this->getDataGenerator()->create_course();
     $record = new stdClass();
     $record->course = $course->id;
     $record->name = "Mod data delete test";
     $record->intro = "Some intro of some sort";
     $record->comments = 1;
     $module = $this->getDataGenerator()->create_module('data', $record);
     $field = data_get_field_new('text', $module);
     $fielddetail = new stdClass();
     $fielddetail->name = 'Name';
     $fielddetail->description = 'Some name';
     $field->define_field($fielddetail);
     $field->insert_field();
     $recordid = data_add_record($module);
     $datacontent = array();
     $datacontent['fieldid'] = $field->field->id;
     $datacontent['recordid'] = $recordid;
     $datacontent['content'] = 'Asterix';
     $contentid = $DB->insert_record('data_content', $datacontent);
     $cm = get_coursemodule_from_instance('data', $module->id, $course->id);
     $context = context_module::instance($module->cmid);
     $cmt = new stdClass();
     $cmt->context = $context;
     $cmt->course = $course;
     $cmt->cm = $cm;
     $cmt->area = 'database_entry';
     $cmt->itemid = $recordid;
     $cmt->showcount = true;
     $cmt->component = 'mod_data';
     $comment = new comment($cmt);
     $newcomment = $comment->add('New comment 1');
     // Triggering and capturing the event.
     $sink = $this->redirectEvents();
     $comment->delete($newcomment->id);
     $events = $sink->get_events();
     $this->assertCount(1, $events);
     $event = reset($events);
     // Checking that the event contains the expected values.
     $this->assertInstanceOf('\\mod_data\\event\\comment_deleted', $event);
     $this->assertEquals($context, $event->get_context());
     $url = new moodle_url('/mod/data/view.php', array('id' => $module->cmid));
     $this->assertEquals($url, $event->get_url());
     $this->assertEventContextNotUsed($event);
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:54,代码来源:lib_test.php

示例3: test_comment_deleted

 /**
  * Test comment_deleted event.
  */
 public function test_comment_deleted()
 {
     global $CFG;
     require_once $CFG->dirroot . '/comment/lib.php';
     // Create a record for deleting comment.
     $this->setAdminUser();
     $course = $this->getDataGenerator()->create_course();
     $glossary = $this->getDataGenerator()->create_module('glossary', array('course' => $course));
     $glossarygenerator = $this->getDataGenerator()->get_plugin_generator('mod_glossary');
     $entry = $glossarygenerator->create_content($glossary);
     $context = context_module::instance($glossary->cmid);
     $cm = get_coursemodule_from_instance('glossary', $glossary->id, $course->id);
     $cmt = new stdClass();
     $cmt->component = 'mod_glossary';
     $cmt->context = $context;
     $cmt->course = $course;
     $cmt->cm = $cm;
     $cmt->area = 'glossary_entry';
     $cmt->itemid = $entry->id;
     $cmt->showcount = true;
     $comment = new comment($cmt);
     $newcomment = $comment->add('New comment 1');
     // Triggering and capturing the event.
     $sink = $this->redirectEvents();
     $comment->delete($newcomment->id);
     $events = $sink->get_events();
     $this->assertCount(1, $events);
     $event = reset($events);
     // Checking that the event contains the expected values.
     $this->assertInstanceOf('\\mod_glossary\\event\\comment_deleted', $event);
     $this->assertEquals($context, $event->get_context());
     $url = new moodle_url('/mod/glossary/view.php', array('id' => $glossary->cmid));
     $this->assertEquals($url, $event->get_url());
     $this->assertEventContextNotUsed($event);
 }
开发者ID:pzhu2004,项目名称:moodle,代码行数:38,代码来源:events_test.php

示例4: dmsg

 case 'ban':
     if ($submit) {
         $do->ban_update($post);
         dmsg('更新成功', '?moduleid=' . $moduleid . '&file=' . $file . '&action=ban&page=' . $page);
     } else {
         $condition = 1;
         if ($mid) {
             $condition = "moduleid={$mid}";
         }
         $lists = $do->get_ban_list($condition);
         include tpl('comment_ban', $module);
     }
     break;
 case 'delete':
     $itemid or msg('请选择评论');
     $do->delete($itemid);
     dmsg('删除成功', $this_forward);
     break;
 case 'check':
     if ($itemid) {
         $status = $status == 3 ? 3 : 2;
         $do->check($itemid, $status);
         dmsg($status == 3 ? '审核成功' : '取消成功', $forward);
     } else {
         $lists = $do->get_list('status=2' . $condition, $dorder[$order]);
         $menuid = 1;
         include tpl('comment', $module);
     }
     break;
 default:
     $lists = $do->get_list('status=3' . $condition, $dorder[$order]);
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:comment.inc.php

示例5: test_comment_deleted

    /**
     * Test comment_deleted event.
     */
    public function test_comment_deleted() {
        global $CFG;

        require_once($CFG->dirroot . '/comment/lib.php');

        // Comment on course page.
        $context = context_course::instance($this->course->id);
        $args = new stdClass;
        $args->context   = $context;
        $args->course    = $this->course;
        $args->area      = 'page_comments';
        $args->itemid    = 0;
        $args->component = 'block_comments';
        $args->linktext  = get_string('showcomments');
        $args->notoggle  = true;
        $args->autostart = true;
        $args->displaycancel = false;
        $comment = new comment($args);
        $newcomment = $comment->add('New comment');

        // Triggering and capturing the event.
        $sink = $this->redirectEvents();
        $comment->delete($newcomment->id);
        $events = $sink->get_events();
        $this->assertCount(1, $events);
        $event = reset($events);

        // Checking that the event contains the expected values.
        $this->assertInstanceOf('\block_comments\event\comment_deleted', $event);
        $this->assertEquals($context, $event->get_context());
        $url = new moodle_url('/course/view.php', array('id' => $this->course->id));
        $this->assertEquals($url, $event->get_url());

        // Comments when block is on module (wiki) page.
        $context = context_module::instance($this->wiki->id);
        $args = new stdClass;
        $args->context   = $context;
        $args->course    = $this->course;
        $args->area      = 'page_comments';
        $args->itemid    = 0;
        $args->component = 'block_comments';
        $args->linktext  = get_string('showcomments');
        $args->notoggle  = true;
        $args->autostart = true;
        $args->displaycancel = false;
        $comment = new comment($args);
        $newcomment = $comment->add('New comment 1');

        // Triggering and capturing the event.
        $sink = $this->redirectEvents();
        $comment->delete($newcomment->id);
        $events = $sink->get_events();
        $this->assertCount(1, $events);
        $event = reset($events);

        // Checking that the event contains the expected values.
        $this->assertInstanceOf('\block_comments\event\comment_deleted', $event);
        $this->assertEquals($context, $event->get_context());
        $url = new moodle_url('/mod/wiki/view.php', array('id' => $this->wiki->id));
        $this->assertEquals($url, $event->get_url());
        $this->assertEventContextNotUsed($event);
    }
开发者ID:rwijaya,项目名称:moodle,代码行数:65,代码来源:events_test.php

示例6: test_comment_deleted

 /**
  * Test comment_deleted event.
  */
 public function test_comment_deleted()
 {
     global $CFG;
     require_once $CFG->dirroot . '/comment/lib.php';
     $this->setUser($this->editingteachers[0]);
     $assign = $this->create_instance();
     $submission = $assign->get_user_submission($this->students[0]->id, true);
     $context = $assign->get_context();
     $options = new stdClass();
     $options->area = 'submission_comments';
     $options->course = $assign->get_course();
     $options->context = $context;
     $options->itemid = $submission->id;
     $options->component = 'assignsubmission_comments';
     $options->showcount = true;
     $options->displaycancel = true;
     $comment = new comment($options);
     $newcomment = $comment->add('New comment 1');
     // Triggering and capturing the event.
     $sink = $this->redirectEvents();
     $comment->delete($newcomment->id);
     $events = $sink->get_events();
     $this->assertCount(1, $events);
     $event = reset($events);
     // Checking that the event contains the expected values.
     $this->assertInstanceOf('\\assignsubmission_comments\\event\\comment_deleted', $event);
     $this->assertEquals($context, $event->get_context());
     $url = new moodle_url('/mod/assign/view.php', array('id' => $assign->get_course_module()->id));
     $this->assertEquals($url, $event->get_url());
     $this->assertEventContextNotUsed($event);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:34,代码来源:events_test.php

示例7:

             echo json_encode($err);
         } else {
             if ($cmt === COMMENT_ERROR_MODULE_REJECT) {
                 $err->error = get_string('modulererejectcomment');
                 echo json_encode($err);
             } else {
                 if ($cmt === COMMENT_ERROR_INSUFFICIENT_CAPS) {
                     $err->error = get_string('nopermissiontocomment');
                     echo json_encode($err);
                 }
             }
         }
     }
     break;
 case 'delete':
     $result = $comment->delete($commentid);
     if ($result === true) {
         echo json_encode(array('client_id' => $client_id, 'commentid' => $commentid));
     } else {
         if ($result == COMMENT_ERROR_INSUFFICIENT_CAPS) {
             $err->error = get_string('nopermissiontoeditcomment');
             echo json_encode($err);
         } else {
             if ($result == COMMENT_ERROR_DB) {
                 $err->error = get_string('dbupdatefailed');
                 echo json_encode($err);
             }
         }
     }
     break;
 case 'get':
开发者ID:ajv,项目名称:Offline-Caching,代码行数:31,代码来源:comment_ajax.php

示例8: comment

<?php
	/**
	* Delete Comment from couch, based on on comment ID and revision ID.
	*/

	include_once '../functions/class.comment.php';
	$c=new comment();
	$c->delete($_POST['commentId'],$_POST['revId']);

?>
开发者ID:nitcalicut,项目名称:Paathshaala,代码行数:10,代码来源:deletecomment.php

示例9:

<?php

if (!empty($_GET['delete']) && $_GET['delete'] == 1) {
    $comment_id = $_GET['comment_id'];
    include_once 'comment.php?comment_id=' . $comment_id;
    $result = comment::delete($comment_id);
    echo '<div id="delete_comment">';
    if ($result == 1) {
        echo '<div class="message">Comment is deleted!</div>';
    } else {
        return false;
    }
    echo '</div>';
}
开发者ID:moxymokaya,项目名称:inoERP,代码行数:14,代码来源:json.comment.php

示例10: test_user_competency_comment_deleted

 /**
  * Test plan comment deleted event.
  */
 public function test_user_competency_comment_deleted()
 {
     $this->resetAfterTest(true);
     $this->setAdminUser();
     $dg = $this->getDataGenerator();
     $lpg = $this->getDataGenerator()->get_plugin_generator('core_competency');
     $user = $dg->create_user();
     $fr = $lpg->create_framework();
     $c = $lpg->create_competency(array('competencyframeworkid' => $fr->get_id()));
     $uc = $lpg->create_user_competency(array('userid' => $user->id, 'competencyid' => $c->get_id()));
     $context = context_user::instance($user->id);
     $cmt = new stdClass();
     $cmt->context = $context;
     $cmt->area = 'user_competency';
     $cmt->itemid = $uc->get_id();
     $cmt->component = 'competency';
     $manager = new comment($cmt);
     $newcomment = $manager->add("Comment to be deleted");
     // Triggering and capturing the event.
     $sink = $this->redirectEvents();
     $manager->delete($newcomment->id);
     $events = $sink->get_events();
     $this->assertCount(1, $events);
     $event = reset($events);
     // Checking that the event contains the expected values.
     $this->assertInstanceOf('\\core\\event\\competency_comment_deleted', $event);
     $this->assertEquals($context, $event->get_context());
     $this->assertEquals($uc->get_id(), $event->other['itemid']);
     $this->assertEventContextNotUsed($event);
     $this->assertDebuggingNotCalled();
 }
开发者ID:evltuma,项目名称:moodle,代码行数:34,代码来源:event_test.php

示例11: remove

 public function remove($id)
 {
     $comment = new comment();
     $comment->find($id);
     $comment->delete();
     if ($this->isAjax()) {
         echo $id;
     } else {
         $this->redirect("comments");
     }
 }
开发者ID:ravenlp,项目名称:CodiceCMS,代码行数:11,代码来源:comments_controller.php

示例12: urldecode

require 'path.php';
init_cobalt('Delete comment');
if (isset($_GET['id'])) {
    $id = urldecode($_GET['id']);
    require_once 'form_data_comment.php';
}
if (xsrf_guard()) {
    init_var($_POST['btn_cancel']);
    init_var($_POST['btn_delete']);
    require 'components/query_string_standard.php';
    if ($_POST['btn_cancel']) {
        log_action('Pressed cancel button');
        redirect("listview_comment.php?{$query_string}");
    } elseif ($_POST['btn_delete']) {
        log_action('Pressed delete button');
        require_once 'subclasses/comment.php';
        $dbh_comment = new comment();
        $object_name = 'dbh_comment';
        require 'components/create_form_data.php';
        $dbh_comment->delete($arr_form_data);
        redirect("listview_comment.php?{$query_string}");
    }
}
require 'subclasses/comment_html.php';
$html = new comment_html();
$html->draw_header('Delete Comment', $message, $message_type);
$html->draw_listview_referrer_info($filter_field_used, $filter_used, $page_from, $filter_sort_asc, $filter_sort_desc);
$html->draw_hidden('id');
$html->detail_view = TRUE;
$html->draw_controls('delete');
$html->draw_footer();
开发者ID:seans888,项目名称:APC-CPO,代码行数:31,代码来源:delete_comment.php

示例13: nvweb_comments


//.........这里部分代码省略.........
                            if (!isset($vars['notify']) || $vars['notify'] == 'callback') {
                                nvweb_after_body("js", $callback . '("' . $response . '");');
                            }
                        }
                    } else {
                        $response = t(344, "Security error");
                        if ($vars['notify'] == 'inline' || $callback_error == 'inline') {
                            $out = '<div class="comment-error">' . $response . '</div>';
                        } else {
                            if (!isset($vars['notify']) || $vars['notify'] == 'callback') {
                                nvweb_after_body("js", $callback_error . '("' . $response . '");');
                            }
                        }
                    }
                } else {
                    $response = t(56, "Unexpected error");
                    if ($vars['notify'] == 'inline' || $callback_error == 'inline') {
                        $out = '<div class="comment-error">' . $response . '</div>';
                    } else {
                        if (!isset($vars['notify']) || $vars['notify'] == 'callback') {
                            nvweb_after_body("js", $callback_error . '("' . $response . '");');
                        }
                    }
                }
            }
            if (isset($_GET['nv_remove_comment'])) {
                // process 1-click comment removal
                $comment = new comment();
                $comment->load($_GET['id']);
                if (!empty($comment->id) && $comment->status == -1) {
                    $hash = $_GET['hash'];
                    if ($hash == sha1($comment->id . $comment->email . APP_UNIQUE . serialize($website->contact_emails))) {
                        // hash check passed
                        $comment->delete();
                        $response = t(55, "Item successfully deleted");
                        if ($vars['notify'] == 'inline' || $callback == 'inline') {
                            $out = '<div class="comment-success">' . $response . '</div>';
                        } else {
                            if (!isset($vars['notify']) || $vars['notify'] == 'callback') {
                                nvweb_after_body("js", $callback . '("' . $response . '");');
                            }
                        }
                    } else {
                        $response = t(344, "Security error");
                        if ($vars['notify'] == 'inline' || $callback_error == 'inline') {
                            $out = '<div class="comment-error">' . $response . '</div>';
                        } else {
                            if (!isset($vars['notify']) || $vars['notify'] == 'callback') {
                                nvweb_after_body("js", $callback_error . '("' . $response . '");');
                            }
                        }
                    }
                } else {
                    $response = t(56, "Unexpected error");
                    if ($vars['notify'] == 'inline' || $callback_error == 'inline') {
                        $out = '<div class="comment-error">' . $response . '</div>';
                    } else {
                        if (!isset($vars['notify']) || $vars['notify'] == 'callback') {
                            nvweb_after_body("js", $callback_error . '("' . $response . '");');
                        }
                    }
                }
            }
            if ($_REQUEST['form-type'] == 'comment-reply' || isset($_POST[$vars['field-message']])) {
                // add comment
                if (empty($vars['field-name'])) {
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:67,代码来源:comments.php

示例14: run

function run()
{
    global $user;
    global $layout;
    global $DB;
    global $website;
    $out = '';
    $item = new comment();
    switch ($_REQUEST['act']) {
        case 'json':
        case 1:
            // json data retrieval & operations
            switch ($_REQUEST['oper']) {
                case 'del':
                    // remove rows
                    $ids = $_REQUEST['ids'];
                    foreach ($ids as $id) {
                        $item->load($id);
                        $item->delete();
                    }
                    echo json_encode(true);
                    break;
                default:
                    // list or search
                    $page = intval($_REQUEST['page']);
                    $max = intval($_REQUEST['rows']);
                    $offset = ($page - 1) * $max;
                    $orderby = $_REQUEST['sidx'] . ' ' . $_REQUEST['sord'];
                    $where = ' website = ' . $website->id;
                    if ($_REQUEST['_search'] == 'true' || isset($_REQUEST['quicksearch'])) {
                        if (isset($_REQUEST['quicksearch'])) {
                            $where .= $item->quicksearch($_REQUEST['quicksearch']);
                        } else {
                            if (isset($_REQUEST['filters'])) {
                                $where .= navitable::jqgridsearch($_REQUEST['filters']);
                            } else {
                                // single search
                                $where .= ' AND ' . navitable::jqgridcompare($_REQUEST['searchField'], $_REQUEST['searchOper'], $_REQUEST['searchString']);
                            }
                        }
                    }
                    $DB->queryLimit('id,item,user,email,date_created,status,message', 'nv_comments', $where, $orderby, $offset, $max);
                    $dataset = $DB->result();
                    $total = $DB->foundRows();
                    //echo $DB->get_last_error();
                    $out = array();
                    $permissions = array(-1 => '<img src="img/icons/silk/new.png" align="absmiddle" /> ' . t(257, 'To review'), 0 => '<img src="img/icons/silk/world.png" align="absmiddle" /> ' . t(64, 'Published'), 1 => '<img src="img/icons/silk/world_dawn.png" align="absmiddle" /> ' . t(251, 'Private'), 2 => '<img src="img/icons/silk/world_night.png" align="absmiddle" /> ' . t(181, 'Hidden'), 3 => '<img src="img/icons/silk/error.png" align="absmiddle" /> ' . t(466, 'Spam'));
                    for ($i = 0; $i < count($dataset); $i++) {
                        if (empty($dataset[$i])) {
                            continue;
                        }
                        // retrieve webuser name
                        $webuser = $DB->query_single('username', 'nv_webusers', ' id = ' . $dataset[$i]['user']);
                        // retrieve item title
                        $item = new item();
                        $item->load($dataset[$i]['item']);
                        $title = $item->dictionary[$website->languages_list[0]]['title'];
                        $message = core_string_clean($dataset[$i]['message']);
                        $message = core_string_cut($message, 60, '&hellip;');
                        $out[$i] = array(0 => $dataset[$i]['id'], 1 => $title, 2 => core_ts2date($dataset[$i]['date_created'], true), 3 => empty($dataset[$i]['user']) ? $dataset[$i]['email'] : $webuser, 4 => strip_tags($message), 5 => $permissions[$dataset[$i]['status']]);
                    }
                    navitable::jqgridJson($out, $page, $offset, $max, $total);
                    break;
            }
            session_write_close();
            exit;
            break;
        case 2:
            // edit/new form
        // edit/new form
        case 'edit':
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
            }
            if (isset($_REQUEST['form-sent'])) {
                $item->load_from_post();
                try {
                    $item->save();
                    property::save_properties_from_post('comment', $item->id);
                    $layout->navigate_notification(t(53, "Data saved successfully."), false, false, 'fa fa-check');
                } catch (Exception $e) {
                    $layout->navigate_notification($e->getMessage(), true, true);
                }
                if (!empty($item->id)) {
                    users_log::action($_REQUEST['fid'], $item->id, 'save', $item->name, json_encode($_REQUEST));
                }
            } else {
                if (!empty($item->id)) {
                    users_log::action($_REQUEST['fid'], $item->id, 'load', $item->name);
                }
            }
            $out = comments_form($item);
            break;
        case 4:
            // remove
        // remove
        case 'remove':
            if (!empty($_REQUEST['id'])) {
                $item->load(intval($_REQUEST['id']));
                if ($item->delete() > 0) {
//.........这里部分代码省略.........
开发者ID:NavigateCMS,项目名称:Navigate-CMS,代码行数:101,代码来源:comments.php

示例15: array

switch ($action) {
    case 'add':
        if ($manager->can_post()) {
            $result = $manager->add($content);
            if (!empty($result) && is_object($result)) {
                $result->count = $manager->count();
                $result->client_id = $client_id;
                echo json_encode($result);
                die;
            }
        }
        break;
    case 'delete':
        $comment_record = $DB->get_record('comments', array('id' => $commentid));
        if ($manager->can_delete($commentid) || $comment_record->userid == $USER->id) {
            if ($manager->delete($commentid)) {
                $result = array('client_id' => $client_id, 'commentid' => $commentid);
                echo json_encode($result);
                die;
            }
        }
        break;
    case 'get':
    default:
        if ($manager->can_view()) {
            $comments = $manager->get_comments($page);
            $result = array('list' => $comments, 'count' => $manager->count(), 'pagination' => $manager->get_pagination($page), 'client_id' => $client_id);
            echo json_encode($result);
            die;
        }
        break;
开发者ID:evltuma,项目名称:moodle,代码行数:31,代码来源:comment_ajax.php


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