本文整理汇总了PHP中wiki_add_comment函数的典型用法代码示例。如果您正苦于以下问题:PHP wiki_add_comment函数的具体用法?PHP wiki_add_comment怎么用?PHP wiki_add_comment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wiki_add_comment函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: add_comment
private function add_comment($content, $idcomment) {
global $CFG, $PAGE;
require_once($CFG->dirroot . "/mod/wiki/locallib.php");
$pageid = $this->page->id;
wiki_add_comment($this->modcontext, $pageid, $content, $this->format);
if (!$idcomment) {
redirect($CFG->wwwroot . '/mod/wiki/comments.php?pageid=' . $pageid, get_string('createcomment', 'wiki'), 2);
} else {
$this->delete_comment($idcomment);
redirect($CFG->wwwroot . '/mod/wiki/comments.php?pageid=' . $pageid, get_string('editingcomment', 'wiki'), 2);
}
}
示例2: test_comment_deleted
/**
* Test comment_deleted event.
*/
public function test_comment_deleted()
{
$this->setUp();
$page = $this->wikigenerator->create_first_page($this->wiki);
$context = context_module::instance($this->wiki->cmid);
// Add comment so we can delete it later.
wiki_add_comment($context, $page->id, 'Test comment', 'html');
$comment = wiki_get_comments($context->id, $page->id);
$this->assertCount(1, $comment);
$comment = array_shift($comment);
// Triggering and capturing the event.
$sink = $this->redirectEvents();
wiki_delete_comment($comment->id, $context, $page->id);
$events = $sink->get_events();
$this->assertCount(1, $events);
$event = reset($events);
// Checking that the event contains the expected values.
$this->assertInstanceOf('\\mod_wiki\\event\\comment_deleted', $event);
$this->assertEquals($context, $event->get_context());
$this->assertEquals($page->id, $event->other['itemid']);
$this->assertEventContextNotUsed($event);
}