本文整理汇总了PHP中wiki_delete_old_locks函数的典型用法代码示例。如果您正苦于以下问题:PHP wiki_delete_old_locks函数的具体用法?PHP wiki_delete_old_locks怎么用?PHP wiki_delete_old_locks使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wiki_delete_old_locks函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: print_edit
protected function print_edit($content = null) {
global $CFG, $OUTPUT, $USER, $PAGE;
if (!$this->check_locks()) {
return;
}
//delete old locks (> 1 hour)
wiki_delete_old_locks();
$version = wiki_get_current_version($this->page->id);
$format = $version->contentformat;
if ($content == null) {
if (empty($this->section)) {
$content = $version->content;
} else {
$content = $this->sectioncontent;
}
}
$versionnumber = $version->version;
if ($this->versionnumber >= 0) {
if ($version->version != $this->versionnumber) {
print $OUTPUT->box(get_string('wrongversionlock', 'wiki'), 'errorbox');
$versionnumber = $this->versionnumber;
}
}
$url = $CFG->wwwroot . '/mod/wiki/edit.php?pageid=' . $this->page->id;
if (!empty($this->section)) {
$url .= "§ion=" . urlencode($this->section);
}
$params = array(
'attachmentoptions' => page_wiki_edit::$attachmentoptions,
'format' => $version->contentformat,
'version' => $versionnumber,
'pagetitle' => $this->page->title,
'contextid' => $this->modcontext->id
);
$data = new StdClass();
$data->newcontent = $content;
$data->version = $versionnumber;
$data->format = $format;
switch ($format) {
case 'html':
$data->newcontentformat = FORMAT_HTML;
// Append editor context to editor options, giving preference to existing context.
page_wiki_edit::$attachmentoptions = array_merge(array('context' => $this->modcontext), page_wiki_edit::$attachmentoptions);
$data = file_prepare_standard_editor($data, 'newcontent', page_wiki_edit::$attachmentoptions, $this->modcontext, 'mod_wiki', 'attachments', $this->subwiki->id);
break;
default:
break;
}
if ($version->contentformat != 'html') {
$params['fileitemid'] = $this->subwiki->id;
$params['component'] = 'mod_wiki';
$params['filearea'] = 'attachments';
}
if (!empty($CFG->usetags)) {
$params['tags'] = tag_get_tags_csv('wiki_pages', $this->page->id, TAG_RETURN_TEXT);
}
$form = new mod_wiki_edit_form($url, $params);
if ($formdata = $form->get_data()) {
if (!empty($CFG->usetags)) {
$data->tags = $formdata->tags;
}
} else {
if (!empty($CFG->usetags)) {
$data->tags = tag_get_tags_array('wiki', $this->page->id);
}
}
$form->set_data($data);
$form->display();
}
开发者ID:Burick,项目名称:moodle,代码行数:83,代码来源:pagelib.php
示例2: print_edit
protected function print_edit($content = null) {
global $CFG, $OUTPUT, $USER, $PAGE;
if (!$this->check_locks()) {
return;
}
//delete old locks (> 1 hour)
wiki_delete_old_locks();
$version = wiki_get_current_version($this->page->id);
$format = $version->contentformat;
if ($content == null) {
if (empty($this->section)) {
$content = $version->content;
} else {
$content = $this->sectioncontent;
}
}
$versionnumber = $version->version;
if ($this->versionnumber >= 0) {
if ($version->version != $this->versionnumber) {
print $OUTPUT->box(get_string('wrongversionlock', 'wiki'), 'errorbox');
$versionnumber = $this->versionnumber;
}
}
$url = $CFG->wwwroot . '/mod/wiki/edit.php?pageid=' . $this->page->id;
if (!empty($this->section)) {
$url .= "§ion=" . $this->section;
}
$params = array('attachmentoptions' => page_wiki_edit::$attachmentoptions, 'format' => $version->contentformat, 'version' => $versionnumber, 'pagetitle'=>$this->page->title);
$data = new StdClass();
$data->newcontent = $content;
$data->version = $versionnumber;
$data->format = $format;
switch ($format) {
case 'html':
$data->newcontentformat = FORMAT_HTML;
$data = file_prepare_standard_editor($data, 'newcontent', page_wiki_edit::$attachmentoptions, $this->modcontext, 'mod_wiki', 'attachments', $this->subwiki->id);
break;
default:
//$draftitemid = file_get_submitted_draft_itemid('attachments');
//file_prepare_draft_area($draftitemid, $this->modcontext->id, 'mod_wiki', 'attachments', $this->subwiki->id);
//$data->attachments = $draftitemid;
}
if ($version->contentformat != 'html') {
$params['contextid'] = $this->modcontext->id;
$params['component'] = 'mod_wiki';
$params['filearea'] = 'attachments';
$params['fileitemid'] = $this->subwiki->id;
}
if (!empty($CFG->usetags)) {
$params['tags'] = tag_get_tags_csv('wiki_pages', $this->page->id, TAG_RETURN_TEXT);
}
$form = new mod_wiki_edit_form($url, $params);
if ($formdata = $form->get_data()) {
if ($format != 'html') {
$errors = $this->process_uploads($this->modcontext);
if (!empty($errors)) {
$contenterror = "";
foreach ($errors as $e) {
$contenterror .= "<p>" . get_string('filenotuploadederror', 'wiki', $e->get_filename()) . "</p>";
}
print $OUTPUT->box($contenterror, 'errorbox');
}
}
if (!empty($CFG->usetags)) {
$data->tags = $formdata->tags;
}
} else {
if (!empty($CFG->usetags)) {
$data->tags = tag_get_tags_array('wiki', $this->page->id);
}
}
$form->set_data($data);
$form->display();
}
开发者ID:nfreear,项目名称:moodle,代码行数:88,代码来源:pagelib.php
注:本文中的wiki_delete_old_locks函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论