本文整理汇总了PHP中wiki_delete_locks函数的典型用法代码示例。如果您正苦于以下问题:PHP wiki_delete_locks函数的具体用法?PHP wiki_delete_locks怎么用?PHP wiki_delete_locks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wiki_delete_locks函数的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: print_overridelocks
private function print_overridelocks() {
global $CFG;
wiki_delete_locks($this->page->id, null, $this->section, true, true);
$args = "pageid=" . $this->page->id;
if (!empty($this->section)) {
$args .= "§ion=" . urlencode($this->section);
}
redirect($CFG->wwwroot . '/mod/wiki/edit.php?' . $args, get_string('overridinglocks', 'wiki'), 2);
}
开发者ID:Burick,项目名称:moodle,代码行数:13,代码来源:pagelib.php
示例3: 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
示例4: page_wiki_save
}
$wikipage = new page_wiki_save($wiki, $subwiki, $cm);
$wikipage->set_page($page);
$wikipage->set_newcontent($newcontent);
$wikipage->set_upload(true);
} else {
if ($option == get_string('preview')) {
if (!confirm_sesskey()) {
print_error(get_string('invalidsesskey', 'wiki'));
}
$wikipage = new page_wiki_preview($wiki, $subwiki, $cm);
$wikipage->set_page($page);
} else {
if ($option == get_string('cancel')) {
//delete lock
wiki_delete_locks($page->id, $USER->id, $section);
redirect($CFG->wwwroot . '/mod/wiki/view.php?pageid=' . $pageid);
} else {
$wikipage = new page_wiki_edit($wiki, $subwiki, $cm);
$wikipage->set_page($page);
$wikipage->set_upload($option == get_string('upload', 'wiki'));
}
}
if (has_capability('mod/wiki:overridelock', $context)) {
$wikipage->set_overridelock(true);
}
}
if ($version >= 0) {
$wikipage->set_versionnumber($version);
}
if (!empty($section)) {
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:31,代码来源:edit.php
示例5: edit_page
/**
* Edit a page contents.
*
* @param int $pageid The page ID.
* @param string $content Page contents.
* @param int $section Section to be edited.
* @return array of warnings and page data.
* @since Moodle 3.1
*/
public static function edit_page($pageid, $content, $section = null)
{
global $USER;
$params = self::validate_parameters(self::edit_page_parameters(), array('pageid' => $pageid, 'content' => $content, 'section' => $section));
$warnings = array();
// Get wiki page.
if (!($page = wiki_get_page($params['pageid']))) {
throw new moodle_exception('incorrectpageid', 'wiki');
}
// Get wiki instance.
if (!($wiki = wiki_get_wiki_from_pageid($params['pageid']))) {
throw new moodle_exception('incorrectwikiid', 'wiki');
}
// Get subwiki instance.
if (!($subwiki = wiki_get_subwiki($page->subwikiid))) {
throw new moodle_exception('incorrectsubwikiid', 'wiki');
}
// Permission validation.
$cm = get_coursemodule_from_instance('wiki', $wiki->id, $wiki->course);
$context = context_module::instance($cm->id);
self::validate_context($context);
if (!wiki_user_can_edit($subwiki)) {
throw new moodle_exception('cannoteditpage', 'wiki');
}
if (wiki_is_page_section_locked($page->id, $USER->id, $params['section'])) {
throw new moodle_exception('pageislocked', 'wiki');
}
// Save content.
if (!is_null($params['section'])) {
$version = wiki_get_current_version($page->id);
$content = wiki_parser_proxy::get_section($version->content, $version->contentformat, $params['section'], false);
if (!$content) {
throw new moodle_exception('invalidsection', 'wiki');
}
$save = wiki_save_section($page, $params['section'], $params['content'], $USER->id);
} else {
$save = wiki_save_page($page, $params['content'], $USER->id);
}
wiki_delete_locks($page->id, $USER->id, $params['section']);
if (!$save) {
throw new moodle_exception('savingerror', 'wiki');
}
$result = array();
$result['pageid'] = $page->id;
$result['warnings'] = $warnings;
return $result;
}
开发者ID:jackdaniels79,项目名称:moodle,代码行数:56,代码来源:external.php
注:本文中的wiki_delete_locks函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论