本文整理匯總了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);
}