/** * Show wiki page delete options * * @param bool $showorphan */ protected function print_delete_content($showorphan = true) { $contents = array(); $table = new html_table(); $table->head = array('', get_string('pagename','wiki')); $table->attributes['class'] = 'generaltable mdl-align'; $swid = $this->subwiki->id; if ($showorphan) { if ($orphanedpages = wiki_get_orphaned_pages($swid)) { $this->add_page_delete_options($orphanedpages, $swid, $table); } else { $table->data[] = array('', get_string('noorphanedpages', 'wiki')); } } else { if ($pages = wiki_get_page_list($swid)) { $this->add_page_delete_options($pages, $swid, $table); } else { $table->data[] = array('', get_string('nopages', 'wiki')); } } ///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' => $this->page->id))); echo html_writer::empty_tag('input', array('type' => 'hidden', 'name' => 'option', 'value' => $this->view)); echo html_writer::table($table); echo html_writer::start_tag('div', array('class' => 'mdl-align')); if (!$showorphan) { echo html_writer::empty_tag('input', array( 'type' => 'submit', 'class' => 'wiki_form-button', 'value' => get_string('listorphan', 'wiki'), 'sesskey' => sesskey())); } else { echo html_writer::empty_tag('input', array('type'=>'hidden', 'name'=>'listall', 'value'=>'1')); echo html_writer::empty_tag('input', array( 'type' => 'submit', 'class' => 'wiki_form-button', 'value' => get_string('listall', 'wiki'), 'sesskey' => sesskey())); } echo html_writer::end_tag('div'); echo html_writer::end_tag('form'); }
/** * Prints the orphaned tab content * * */ private function print_orphaned_content() { global $OUTPUT; $page = $this->page; if ($page->timerendered + WIKI_REFRESH_CACHE_TIME < time()) { $fresh = wiki_refresh_cachedcontent($page); $page = $fresh['page']; } $swid = $this->subwiki->id; $table = new html_table(); $table->head = array(get_string('orphaned', 'wiki') . $OUTPUT->help_icon('orphaned', 'wiki')); $table->attributes['class'] = 'wiki_editor generalbox'; $table->data = array(); $table->rowclasses = array(); if ($orphanedpages = wiki_get_orphaned_pages($swid)) { foreach ($orphanedpages as $page) { $link = wiki_parser_link($page->title, array('swid' => $swid)); $class = $link['new'] ? 'class="wiki_newentry"' : ''; $table->data[] = array('<a href="' . $link['url'] . '"' . $class . '>' . format_string($link['content']) . '</a>'); } } else { $table->data[] = array(get_string('noorphanedpages', 'wiki')); } echo html_writer::table($table); }