function wiki_admin($WS) { global $CFG, $COURSE; $context = get_context_instance(CONTEXT_MODULE, $WS->cm->id); require_capability('mod/wiki:editawiki', $context); $ead = wiki_manager_get_instance(); //new wiki_ead_tools(); $tools = array(array(get_string('mostviewed', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . "&dfcontent=0"), array(get_string('updatest', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . "&dfcontent=1"), array(get_string('newest', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . "&dfcontent=2"), array(get_string('wanted', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . "&dfcontent=3"), array(get_string('orphaned', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . "&dfcontent=4"), array(get_string('activestusers', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . "&dfcontent=5")); $table1->align = array("left"); $table1->tablealign = "left"; $table1->width = '100%'; $table1->cellpadding = 2; $table1->cellspacing = 0; $table1->head = array(get_string("stads", "wiki")); //print public tools $i = 20; foreach ($tools as $tool) { $prop = null; $prop->href = $tool[1]; $out = wiki_a($tool[0], $prop, true); $table1->data[] = array($out); $i++; } if (isset($table1->data)) { print_table($table1); } wiki_br(1); $table2->align = array("left"); $table2->tablealign = "left"; $table2->width = '100%'; $table2->cellpadding = 2; $table2->cellspacing = 0; $table2->head = array(get_string("admin", "wiki")); //teacher page dependant tools $tools = array(array(get_string('delpage', 'wiki'), $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&delpage=' . urlencode($WS->pagedata->pagename) . '&dfsetup=0'), array(get_string('updatepage', 'wiki'), $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&updatepage=' . urlencode($WS->pagedata->pagename) . '&dfsetup=1'), array(get_string('cleanpage', 'wiki'), $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&cleanpage=' . urlencode($WS->pagedata->pagename) . '&dfsetup=2')); //teacher non page dependant tools $tools_indep = array(array(get_string('exportxml', 'wiki'), $CFG->wwwroot . '/mod/wiki/xml/exportxml.php?id=' . $WS->cm->id . '&pageaction=exportxml'), array(get_string('importxml', 'wiki'), $CFG->wwwroot . '/mod/wiki/xml/importxml.php?id=' . $WS->cm->id), array(get_string('viewexported', 'wiki'), $CFG->wwwroot . '/mod/wiki/xml/index.php?id=' . $WS->dfwiki->course . '&wdir=/exportedfiles'), array(get_string('exporthtml', 'wiki'), $CFG->wwwroot . '/mod/wiki/html/exporthtml.php?id=' . $WS->cm->id), array(get_string('wikitopdf', 'wiki'), $CFG->wwwroot . '/mod/wiki/wikitopdf.php?id=' . $WS->cm->id . '&cid=' . $COURSE->id . '&gid=' . $WS->groupmember->groupid . '&page=' . urlencode($WS->pagedata->pagename) . '&version=' . $WS->pagedata->version), array(get_string('wikibooktopdf', 'wiki'), $CFG->wwwroot . '/mod/wiki/export/wikibook2pdf/wikibooktopdf.php?cmid=' . $WS->cm->id . '&cid=' . $COURSE->id . '&gid=' . $WS->groupmember->groupid), array(get_string('eval_reports', 'wiki'), $CFG->wwwroot . '/mod/wiki/grades/grades.evaluation.php?cid=' . $COURSE->id . '&cmid=' . $WS->cm->id)); //public tools $tools_sens = array(array($WS->pagedata->editable == 0, get_string('en1page', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&enpage=' . urlencode($WS->pagedata->pagename) . '&dfsetup=3'), array($WS->pagedata->editable == 1, get_string('en0page', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&enpage=' . urlencode($WS->pagedata->pagename) . '&dfsetup=3')); if (wiki_can_change($WS)) { foreach ($tools as $tool) { $prop = null; $prop->href = $tool[1]; $out = wiki_a($tool[0], $prop, true); $table2->data[] = array($out); $i++; } foreach ($tools_indep as $tool) { $prop = null; $prop->href = $tool[1]; $out = wiki_a($tool[0], $prop, true); $table2->data[] = array($out); } foreach ($tools_sens as $tool) { if ($tool[0]) { // $table2->data[] = array("<form id=\"form$i\" action=\"".$tool[2]."\" method=\"post\">"."\n".'<div><a href="javascript:document.forms[\'form'.$i.'\'].submit()" title="'.$tool[1].' '.$WS->pagedata->pagename.'">'.$tool[1].' '.$WS->pagedata->pagename.'</a>'.$tool[3]."\n"."</div></form>"."\n"); $prop = null; $prop->href = $tool[2]; $out = wiki_a($tool[1] . " " . $WS->pagedata->pagename, $prop, true); $table2->data[] = array($out); $i++; } } } if (isset($table2->data)) { print_table($table2); } }
function wiki_ead_cleanpage() { global $dfwiki_ead_stat; $cleanpage = optional_param('cleanpage', NULL, PARAM_FILE); $dfwiki = wiki_param('dfwiki'); if (wiki_can_change()) { if (wiki_page_exists(false, $cleanpage, false)) { $cleanconfirm = optional_param('dfformcleanconfirm', NULL, PARAM_ALPHA); if (isset($cleanconfirm)) { $cleanvers = optional_param('dfformcleanvers', NULL, PARAM_INT); if (delete_records_select('wiki_pages', 'dfwiki=' . $dfwiki->id . ' and pagename=\'' . addslashes($cleanpage) . '\' and version < ' . $cleanvers)) { $dfwiki_ead_stat = 'cleanok'; } else { $dfwiki_ead_stat = 'cleanerror'; } } else { //show confirm form $dfwiki_ead_stat = 'cleanconfirm'; } } else { //this page can't be eliminated $dfwiki_ead_stat = 'cleanerror'; } } wiki_param('dfcontent', 9); wiki_main_setup(); }
function get_content() { global $CFG, $WS, $COURSE; $basedir = '/mod/wiki/images/'; if ($this->content !== NULL) { return $this->content; } //If we are out of a dfwiki activity or in a different //dfwiki format course and we want to create a block: if (empty($WS->dfwiki)) { $this->content->text = get_string('block_warning', 'wiki'); return $this->content; } $this->content = new stdClass(); $this->content->items = array(); $this->content->icons = array(); //$this->content->footer = '<br />'.helpbutton ('ead', get_string('block_ead', 'wiki'), 'wiki', true, false, '', true).get_string('block_ead', 'wiki'); // rtl / ltr CSS alignment support (nadavkav) if (right_to_left()) { $nwikialignment = 'nwikirightnow'; } else { $nwikialignment = 'nwikileftnow'; } //in case course wiki define the correct path for the url $tools = array(array(get_string('mostviewed', 'wiki'), $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id, "<input type=\"hidden\" name=\"dfcontent\" value='0' />"), array(get_string('updatest', 'wiki'), $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id, "<input type=\"hidden\" name=\"dfcontent\" value='1' />"), array(get_string('newest', 'wiki'), $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id, "<input type=\"hidden\" name=\"dfcontent\" value='2' />"), array(get_string('wanted', 'wiki'), $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id, "<input type=\"hidden\" name=\"dfcontent\" value='3' />"), array(get_string('orphaned', 'wiki'), $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id, "<input type=\"hidden\" name=\"dfcontent\" value='4' />"), array(get_string('activestusers', 'wiki'), $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id, "<input type=\"hidden\" name=\"dfcontent\" value='5' />")); $text = "\n" . '<table border="0" cellpadding="0" cellspacing="0">' . "\n"; //print public tools $i = 0; foreach ($tools as $tool) { $text .= '<tr><td class="' . $nwikialignment . '">' . "\n"; $text .= "<form id=\"form{$i}\" action=\"" . $CFG->wwwroot . $WS->wikitype . $tool[1] . "\" method=\"post\"><div>" . "\n"; //$text.= ' '; //$text.= '<img src="'.$CFG->wwwroot.$basedir.$tool[3].'" alt="" />'; $text .= '<a href="javascript:document.forms[\'form' . $i . '\'].submit()">' . $tool[0] . '</a>' . $tool[2] . "\n"; $text .= '</div></form>' . '</td></tr>' . "\n"; $i++; } $text .= '<tr><td><hr /></td></tr>' . "\n"; //teacher page dependant tools $tools = array(array(get_string('delpage', 'wiki'), $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&delpage=' . urlencode($WS->pagedata->pagename), "<input type=\"hidden\" name=\"dfsetup\" value='0' />", 'deleteB.gif'), array(get_string('updatepage', 'wiki'), $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&updatepage=' . urlencode($WS->pagedata->pagename), "<input type=\"hidden\" name=\"dfsetup\" value='1' />", 'refresh.gif'), array(get_string('cleanpage', 'wiki'), $CFG->wwwroot . '/mod/wiki/view.php?id=' . $WS->cm->id . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&cleanpage=' . urlencode($WS->pagedata->pagename), "<input type=\"hidden\" name=\"dfsetup\" value='2' />", 'broom.gif')); //teacher non page dependant tools $tools_indep = array(array(get_string('exportxml', 'wiki'), $CFG->wwwroot . '/mod/wiki/xml/exportxml.php?id=' . $WS->cm->id . '&pageaction=exportxml', 'backup.gif'), array(get_string('importxml', 'wiki'), $CFG->wwwroot . '/mod/wiki/xml/importxml.php?id=' . $WS->cm->id, 'restore.gif'), array(get_string('viewexported', 'wiki'), $CFG->wwwroot . '/mod/wiki/xml/index.php?id=' . $WS->dfwiki->course . '&wdir=/exportedfiles', 'files.gif'), array(get_string('exporthtml', 'wiki'), $CFG->wwwroot . '/mod/wiki/html/exporthtml.php?id=' . $WS->cm->id, 'backup.gif'), array(get_string('dfwikitonewwiki', 'wiki'), $CFG->wwwroot . '/mod/wiki/dfwikitonewwiki.php?id=' . $WS->cm->id, 'dfwiki.gif'), array(get_string('wikitopdf', 'wiki'), $CFG->wwwroot . '/mod/wiki/wikitopdf.php?id=' . $WS->cm->id . '&cid=' . $COURSE->id . '&gid=' . $WS->groupmember->groupid . '&version=' . $WS->pagedata->version, 'pdf.gif'), array(get_string('wikibooktopdf', 'wiki'), $CFG->wwwroot . '/mod/wiki/export/wikibook2pdf/wikibooktopdf.php?cmid=' . $WS->cm->id . '&cid=' . $COURSE->id . '&gid=' . $WS->groupmember->groupid, 'pdf.gif'), array(get_string('eval_reports', 'wiki'), $CFG->wwwroot . '/mod/wiki/grades/grades.evaluation.php?cid=' . $COURSE->id . '&cmid=' . $WS->cm->id, 'template.gif')); //public tools $tools_sens = array(array($WS->pagedata->editable == 0, get_string('en1page', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&enpage=' . urlencode($WS->pagedata->pagename), "<input type=\"hidden\" name=\"dfsetup\" value='3' />", 'edit.gif'), array($WS->pagedata->editable == 1, get_string('en0page', 'wiki'), $CFG->wwwroot . $WS->wikitype . $WS->linkid . '&gid=' . $WS->groupmember->groupid . '&uid=' . $WS->member->id . '&enpage=' . urlencode($WS->pagedata->pagename), "<input type=\"hidden\" name=\"dfsetup\" value='3' />", 'edit.gif')); if (wiki_can_change($WS)) { foreach ($tools as $tool) { $text .= '<tr><td class="' . $nwikialignment . '">' . "\n"; $text .= "<form id=\"form{$i}\" action=\"" . $tool[1] . "\" method=\"post\"><span>" . "\n"; $text .= '<img src="' . $CFG->wwwroot . $basedir . $tool[3] . '" alt="" />'; $text .= ' '; $text .= '<a href="javascript:document.forms[\'form' . $i . '\'].submit()" title="' . urlencode($tool[0] . ' ' . $WS->pagedata->pagename) . '">' . format_text($tool[0] . ' ' . $this->trim_string($WS->pagedata->pagename, 20), FORMAT_PLAIN) . '</a>' . $tool[2] . "\n"; $text .= "</span></form>" . '</td></tr>' . "\n"; $i++; } foreach ($tools_indep as $tool) { $text .= '<tr><td class="' . $nwikialignment . '">'; $text .= '<img src="' . $CFG->wwwroot . $basedir . $tool[2] . '" alt="" />'; $text .= ' '; $text .= '<a href="' . $tool[1] . '">' . $tool[0] . '</a>'; $text .= '</td></tr>' . "\n"; } foreach ($tools_sens as $tool) { if ($tool[0]) { //$text.= '<tr><td nowrap="nowrap"><a href="'.$tool[2].'" title="'.$tool[1].' '.$WS->pagedata->pagename.'">'.$tool[1].' '.$this->trim_string($WS->pagedata->pagename,20).'</a></td></tr>'; $text .= '<tr><td class="' . $nwikialignment . '">' . "\n"; $text .= "<form id=\"form{$i}\" action=\"" . $tool[2] . "\" method=\"post\"><span>"; $text .= '<img src="' . $CFG->wwwroot . $basedir . $tool[4] . '" alt="" />'; $text .= ' '; $text .= '<a href="javascript:document.forms[\'form' . $i . '\'].submit()" title="' . urlencode($tool[1] . ' ' . $WS->pagedata->pagename) . '">' . format_text($tool[1] . ' ' . $this->trim_string($WS->pagedata->pagename, 20), FORMAT_PLAIN) . '</a>' . $tool[3] . "\n"; $text .= "</span></form>" . '</td></tr>' . "\n"; $i++; } } } $text .= '</table>' . "\n"; $this->content->text = $text; return $this->content; }