本文整理汇总了PHP中wiki_get_wiki_page_versions函数的典型用法代码示例。如果您正苦于以下问题:PHP wiki_get_wiki_page_versions函数的具体用法?PHP wiki_get_wiki_page_versions怎么用?PHP wiki_get_wiki_page_versions使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了wiki_get_wiki_page_versions函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: print_delete_version
/**
* Prints lists of versions which can be deleted
*
* @global core_renderer $OUTPUT
* @global moodle_page $PAGE
*/
private function print_delete_version() {
global $OUTPUT, $PAGE;
$pageid = $this->page->id;
// versioncount is the latest version
$versioncount = wiki_count_wiki_page_versions($pageid) - 1;
$versions = wiki_get_wiki_page_versions($pageid, 0, $versioncount);
// We don't want version 0 to be displayed
// version 0 is blank page
if (end($versions)->version == 0) {
array_pop($versions);
}
$contents = array();
$version0page = wiki_get_wiki_page_version($this->page->id, 0);
$creator = wiki_get_user_info($version0page->userid);
$a = new stdClass();
$a->date = userdate($this->page->timecreated, get_string('strftimedaydatetime', 'langconfig'));
$a->username = fullname($creator);
echo $OUTPUT->heading(get_string('createddate', 'wiki', $a), 4, 'wiki_headingtime');
if ($versioncount > 0) {
/// If there is only one version, we don't need radios nor forms
if (count($versions) == 1) {
$row = array_shift($versions);
$username = wiki_get_user_info($row->userid);
$picture = $OUTPUT->user_picture($username);
$date = userdate($row->timecreated, get_string('strftimedate', 'langconfig'));
$time = userdate($row->timecreated, get_string('strftimetime', 'langconfig'));
$versionid = wiki_get_version($row->id);
$versionlink = new moodle_url('/mod/wiki/viewversion.php', array('pageid' => $pageid, 'versionid' => $versionid->id));
$userlink = new moodle_url('/user/view.php', array('id' => $username->id, 'course' => $PAGE->cm->course));
$picturelink = $picture . html_writer::link($userlink->out(false), fullname($username));
$historydate = $OUTPUT->container($date, 'wiki_histdate');
$contents[] = array('', html_writer::link($versionlink->out(false), $row->version), $picturelink, $time, $historydate);
//Show current version
$table = new html_table();
$table->head = array('', get_string('version'), get_string('user'), get_string('modified'), '');
$table->data = $contents;
$table->attributes['class'] = 'mdl-align';
echo html_writer::table($table);
} else {
$lastdate = '';
$rowclass = array();
foreach ($versions as $version) {
$user = wiki_get_user_info($version->userid);
$picture = $OUTPUT->user_picture($user, array('popup' => true));
$date = userdate($version->timecreated, get_string('strftimedate'));
if ($date == $lastdate) {
$date = '';
$rowclass[] = '';
} else {
$lastdate = $date;
$rowclass[] = 'wiki_histnewdate';
}
$time = userdate($version->timecreated, get_string('strftimetime', 'langconfig'));
$versionid = wiki_get_version($version->id);
if ($versionid) {
$url = new moodle_url('/mod/wiki/viewversion.php', array('pageid' => $pageid, 'versionid' => $versionid->id));
$viewlink = html_writer::link($url->out(false), $version->version);
} else {
$viewlink = $version->version;
}
$userlink = new moodle_url('/user/view.php', array('id' => $version->userid, 'course' => $PAGE->cm->course));
$picturelink = $picture . html_writer::link($userlink->out(false), fullname($user));
$historydate = $OUTPUT->container($date, 'wiki_histdate');
$radiofromelement = $this->choose_from_radio(array($version->version => null), 'fromversion', 'M.mod_wiki.deleteversion()', $versioncount, true);
$radiotoelement = $this->choose_from_radio(array($version->version => null), 'toversion', 'M.mod_wiki.deleteversion()', $versioncount, true);
$contents[] = array( $radiofromelement . $radiotoelement, $viewlink, $picturelink, $time, $historydate);
}
$table = new html_table();
$table->head = array(get_string('deleteversions', 'wiki'), get_string('version'), get_string('user'), get_string('modified'), '');
$table->data = $contents;
$table->attributes['class'] = 'generaltable mdl-align';
$table->rowclasses = $rowclass;
///Print the form
echo html_writer::start_tag('form', array('action'=>new moodle_url('/mod/wiki/admin.php'), 'method' => 'post'));
echo html_writer::tag('div', html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'pageid', 'value' => $pageid)));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'option', 'value' => $this->view));
echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'sesskey', 'value' => sesskey()));
echo html_writer::table($table);
echo html_writer::start_tag('div', array('class' => 'mdl-align'));
echo html_writer::empty_tag('input', array('type' => 'submit', 'class' => 'wiki_form-button', 'value' => get_string('deleteversions', 'wiki')));
echo html_writer::end_tag('div');
echo html_writer::end_tag('form');
}
} else {
//.........这里部分代码省略.........
开发者ID:Burick,项目名称:moodle,代码行数:101,代码来源:pagelib.php
示例2: print_history_content
/**
* Prints the history for a given wiki page
*
* @global object $CFG
* @global object $OUTPUT
* @global object $PAGE
*/
private function print_history_content()
{
global $CFG, $OUTPUT, $PAGE;
$pageid = $this->page->id;
$offset = $this->paging * $this->rowsperpage;
// vcount is the latest version
$vcount = wiki_count_wiki_page_versions($pageid) - 1;
if ($this->allversion) {
$versions = wiki_get_wiki_page_versions($pageid, 0, $vcount);
} else {
$versions = wiki_get_wiki_page_versions($pageid, $offset, $this->rowsperpage);
}
// We don't want version 0 to be displayed
// version 0 is blank page
if (end($versions)->version == 0) {
array_pop($versions);
}
$contents = array();
$version0page = wiki_get_wiki_page_version($this->page->id, 0);
$creator = wiki_get_user_info($version0page->userid);
$a = new StdClass();
$a->date = userdate($this->page->timecreated, get_string('strftimedaydatetime', 'langconfig'));
$a->username = $creator->username;
echo $OUTPUT->heading(get_string('createddate', 'wiki', $a), 4, 'wiki_headingtime');
if ($vcount > 0) {
/// If there is only one version, we don't need radios nor forms
if (count($versions) == 1) {
$row = array_shift($versions);
$username = wiki_get_user_info($row->userid);
$picture = $OUTPUT->user_picture($username);
$date = userdate($row->timecreated, get_string('strftimedate', 'langconfig'));
$time = userdate($row->timecreated, get_string('strftimetime', 'langconfig'));
$versionid = wiki_get_version($row->id);
$versionlink = new moodle_url('/mod/wiki/viewversion.php', array('pageid' => $pageid, 'versionid' => $versionid->id));
$userlink = new moodle_url('/user/view.php', array('id' => $username->id));
$contents[] = array('', html_writer::link($versionlink->out(false), $row->version), $picture . html_writer::link($userlink->out(false), fullname($username)), $time, $OUTPUT->container($date, 'wiki_histdate'));
$table = new html_table();
$table->head = array('', get_string('version'), get_string('user'), get_string('modified'), '');
$table->data = $contents;
$table->attributes['class'] = 'mdl-align';
echo html_writer::table($table);
} else {
$checked = $vcount - $offset;
$lastdate = '';
$rowclass = array();
foreach ($versions as $version) {
$user = wiki_get_user_info($version->userid);
$picture = $OUTPUT->user_picture($user, array('popup' => true));
$date = userdate($version->timecreated, get_string('strftimedate'));
if ($date == $lastdate) {
$date = '';
$rowclass[] = '';
} else {
$lastdate = $date;
$rowclass[] = 'wiki_histnewdate';
}
$time = userdate($version->timecreated, get_string('strftimetime', 'langconfig'));
$versionid = wiki_get_version($version->id);
if ($versionid) {
$url = new moodle_url('/mod/wiki/viewversion.php', array('pageid' => $pageid, 'versionid' => $versionid->id));
$viewlink = html_writer::link($url->out(false), $version->version);
} else {
$viewlink = $version->version;
}
$userlink = new moodle_url('/user/view.php', array('id' => $version->userid));
$contents[] = array($this->choose_from_radio(array($version->version => null), 'compare', 'M.mod_wiki.history()', $checked - 1, true) . $this->choose_from_radio(array($version->version => null), 'comparewith', 'M.mod_wiki.history()', $checked, true), $viewlink, $picture . html_writer::link($userlink->out(false), fullname($user)), $time, $OUTPUT->container($date, 'wiki_histdate'));
}
$table = new html_table();
$icon = $OUTPUT->help_icon('diff', 'wiki');
$table->head = array(get_string('diff', 'wiki') . $icon, get_string('version'), get_string('user'), get_string('modified'), '');
$table->data = $contents;
$table->attributes['class'] = 'generaltable mdl-align';
$table->rowclasses = $rowclass;
/*$table = new StdClass();
$table->head = array(helpbutton('diff', 'diff', 'wiki', true, false, '', true, ''),
get_string('version'),
get_string('user'),
get_string('modified'),
'');
$table->data = $contents;
$table->class = 'mdl-align';
$table->rowclass = $rowclass;*/
///Print the form
echo html_writer::start_tag('form', array('action' => new moodle_url('/mod/wiki/diff.php'), 'method' => 'get', 'id' => 'diff'));
echo html_writer::tag('div', html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'pageid', 'value' => $pageid)));
echo html_writer::table($table);
echo html_writer::start_tag('div', array('class' => 'mdl-align'));
echo html_writer::empty_tag('input', array('type' => 'submit', 'class' => 'wiki_form-button', 'value' => get_string('comparesel', 'wiki')));
echo html_writer::end_tag('div');
echo html_writer::end_tag('form');
}
} else {
print_string('nohistory', 'wiki');
//.........这里部分代码省略.........
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:101,代码来源:pagelib.php
注:本文中的wiki_get_wiki_page_versions函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论