本文整理汇总了PHP中wiki_delete_comment函数的典型用法代码示例。如果您正苦于以下问题:PHP wiki_delete_comment函数的具体用法?PHP wiki_delete_comment怎么用?PHP wiki_delete_comment使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wiki_delete_comment函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: wiki_delete_pages
/**
* Delete pages and all related data
*
* @param mixed $context context in which page needs to be deleted.
* @param mixed $pageids id's of pages to be deleted
* @param int $subwikiid id of the subwiki for which all pages should be deleted
*/
function wiki_delete_pages($context, $pageids = null, $subwikiid = null)
{
global $DB;
if (!empty($pageids) && is_int($pageids)) {
$pageids = array($pageids);
} else {
if (!empty($subwikiid)) {
$pageids = wiki_get_page_list($subwikiid);
}
}
//If there is no pageid then return as we can't delete anything.
if (empty($pageids)) {
return;
}
/// Delete page and all it's relevent data
foreach ($pageids as $pageid) {
if (is_object($pageid)) {
$pageid = $pageid->id;
}
//Delete page comments
$comments = wiki_get_comments($context->id, $pageid);
foreach ($comments as $commentid => $commentvalue) {
wiki_delete_comment($commentid, $context, $pageid);
}
//Delete page tags
$tags = tag_get_tags_array('wiki_pages', $pageid);
foreach ($tags as $tagid => $tagvalue) {
tag_delete_instance('wiki_pages', $pageid, $tagid);
}
//Delete Synonym
wiki_delete_synonym($subwikiid, $pageid);
//Delete all page versions
wiki_delete_page_versions(array($pageid => array(0)));
//Delete all page locks
wiki_delete_locks($pageid);
//Delete all page links
wiki_delete_links(null, $pageid);
//Delete page
$params = array('id' => $pageid);
$DB->delete_records('wiki_pages', $params);
}
}
开发者ID:esyacelga,项目名称:sisadmaca,代码行数:49,代码来源:locallib.php
示例2: delete_comment
private function delete_comment($commentid) {
global $CFG, $PAGE;
$pageid = $this->page->id;
wiki_delete_comment($commentid, $this->modcontext, $pageid);
}
开发者ID:Burick,项目名称:moodle,代码行数:7,代码来源:pagelib.php
示例3: 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
示例4: wiki_delete_pages
/**
* Delete pages and all related data
*
* @param mixed $context context in which page needs to be deleted.
* @param mixed $pageids id's of pages to be deleted
* @param int $subwikiid id of the subwiki for which all pages should be deleted
*/
function wiki_delete_pages($context, $pageids = null, $subwikiid = null)
{
global $DB, $CFG;
if (!empty($pageids) && is_int($pageids)) {
$pageids = array($pageids);
} else {
if (!empty($subwikiid)) {
$pageids = wiki_get_page_list($subwikiid);
}
}
//If there is no pageid then return as we can't delete anything.
if (empty($pageids)) {
return;
}
/// Delete page and all it's relevent data
foreach ($pageids as $pageid) {
if (is_object($pageid)) {
$pageid = $pageid->id;
}
//Delete page comments
$comments = wiki_get_comments($context->id, $pageid);
foreach ($comments as $commentid => $commentvalue) {
wiki_delete_comment($commentid, $context, $pageid);
}
//Delete page tags
core_tag_tag::remove_all_item_tags('mod_wiki', 'wiki_pages', $pageid);
//Delete Synonym
wiki_delete_synonym($subwikiid, $pageid);
//Delete all page versions
wiki_delete_page_versions(array($pageid => array(0)), $context);
//Delete all page locks
wiki_delete_locks($pageid);
//Delete all page links
wiki_delete_links(null, $pageid);
$params = array('id' => $pageid);
// Get page before deleting.
$page = $DB->get_record('wiki_pages', $params);
//Delete page
$DB->delete_records('wiki_pages', $params);
// Trigger page_deleted event.
$event = \mod_wiki\event\page_deleted::create(array('context' => $context, 'objectid' => $pageid, 'other' => array('subwikiid' => $subwikiid)));
$event->add_record_snapshot('wiki_pages', $page);
$event->trigger();
}
}
开发者ID:isuruAb,项目名称:moodle,代码行数:52,代码来源:locallib.php
示例5: delete_comment
private function delete_comment($commentid) {
global $CFG, $PAGE;
$cm = $PAGE->cm;
$context = get_context_instance(CONTEXT_MODULE, $cm->id);
$pageid = $this->page->id;
wiki_delete_comment($commentid, $context, $pageid);
}
开发者ID:nuckey,项目名称:moodle,代码行数:9,代码来源:pagelib.php
注:本文中的wiki_delete_comment函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论