當前位置: 首頁>>代碼示例>>PHP>>正文


PHP wiki_add_comment函數代碼示例

本文整理匯總了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);
        }
    }
開發者ID:Burick,項目名稱:moodle,代碼行數:15,代碼來源:pagelib.php

示例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);
 }
開發者ID:evltuma,項目名稱:moodle,代碼行數:25,代碼來源:events_test.php


注:本文中的wiki_add_comment函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。