本文整理汇总了PHP中ouwiki_display_wiki_parameters函数的典型用法代码示例。如果您正苦于以下问题:PHP ouwiki_display_wiki_parameters函数的具体用法?PHP ouwiki_display_wiki_parameters怎么用?PHP ouwiki_display_wiki_parameters使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ouwiki_display_wiki_parameters函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ouwiki_display_page_in_index
function ouwiki_display_page_in_index($indexitem, $subwiki, $cm)
{
if ($startpage = is_null($indexitem->title)) {
$title = get_string('startpage', 'ouwiki');
$output = '<div class="ouw_index_startpage">';
} else {
$title = $indexitem->title;
$output = '';
}
$output .= '<a class="ouw_title" href="view.php?' . ouwiki_display_wiki_parameters($indexitem->title, $subwiki, $cm) . '">' . htmlspecialchars($title) . '</a>';
$lastchange = new StdClass();
$lastchange->userlink = ouwiki_display_user($indexitem, $cm->course);
$lastchange->date = ouwiki_recent_span($indexitem->timecreated) . ouwiki_nice_date($indexitem->timecreated) . '</span>';
$output .= '<div class="ouw_indexinfo">';
$output .= ' <span class="ouw_lastchange">' . get_string('lastchange', 'ouwiki', $lastchange) . '</span>';
$output .= '</div>';
if ($startpage) {
$output .= '</div>';
}
return $output;
}
示例2: dirname
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Import page content from other ouwiki activities into this wiki.
* @package mod
* @subpackage ouwiki
* @copyright 2013 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require_once dirname(__FILE__) . '/../../config.php';
require $CFG->dirroot . '/mod/ouwiki/basicpage.php';
require $CFG->dirroot . '/mod/ouwiki/import_form.php';
$pageparams = ouwiki_display_wiki_parameters($pagename, $subwiki, $cm, OUWIKI_PARAMS_ARRAY);
/* Define/work out the step of the import process we are on.
Step 1 - Select wiki (+sub wiki)
Step 2 - Select pages
Step 3 - Confirm
Step 4 - Process import
*/
$curstep = optional_param('step', 1, PARAM_INT);
if (optional_param('cancel', '', PARAM_TEXT) == get_string('cancel')) {
// Cancelled last step, go back one.
$curstep -= 2;
}
$pageparams['step'] = $curstep;
$url = new moodle_url('/mod/ouwiki/import.php', array('id' => $id, 'page' => $pagename));
$PAGE->set_url($url);
$PAGE->set_cm($cm);
示例3: reportsuser_usercommentstable
/**
* Print the table which list the comments by the user in this subwiki,
* with the date of the comment and a link to the page
*
* @param unknown_type $subwiki the subwiki in question
* @param unknown_type $cm
* @param unknown_type $userid the id of the user
* @param unknown_type $header the header text for the table
*/
function reportsuser_usercommentstable($subwiki, $cm, $userid, $header, $csv)
{
// get the user comments info
$usercomments = ouwiki_get_usercomments($subwiki->id, $userid);
if (count($usercomments) == 0) {
return;
}
// Print the opening div and table tags as well as the header row
if (!$csv) {
print <<<EOF
<div class="ouw_usercommentslist">
\t<h3>{$header->comments}</h3>
\t<table>
\t\t<tr>
\t\t\t<th class='ouw_leftcol' scope="col">{$header->datetime}</th>
\t\t\t<th class='ouw_rightcol' scope="col">{$header->pagename}</th>\t\t\t
\t\t</tr>\t\t
EOF;
} else {
print $csv->line() . $csv->quote($header->comments) . $csv->line() . $csv->quote($header->datetime) . $csv->sep() . $csv->quote($header->pagename) . $csv->line();
}
// for each comment in this subwiki by the user
foreach ($usercomments as $usercomment) {
// get the date and time of the comment
$datetime = ouwiki_nice_date($usercomment->timeposted);
// get the page title of the page with the comment
$title = $usercomment->title;
// make it html safe
$pagetitle = htmlspecialchars($title);
// create html link to the page
$pagelink = "<a href='view.php?" . ouwiki_display_wiki_parameters($title, $subwiki, $cm) . "'>{$pagetitle}</a>";
// if title is blank then must be subwiki start page - create link to there
if ($title == '') {
$pagelink = "<a href='view.php?" . ouwiki_display_wiki_parameters(null, $subwiki, $cm) . "'>" . get_string('startpage', 'ouwiki') . "</a>";
}
// print the table row for date and time and page link for comments by user
if (!$csv) {
print <<<EOF
\t\t<tr>
\t\t\t<td class='ouw_leftcol'>{$datetime}</td>
\t\t\t<td class='ouw_rightcol'>{$pagelink}</td>\t
\t\t</tr>\t\t
EOF;
} else {
if ($title == '') {
$title = get_string('startpage', 'ouwiki');
}
print $csv->quote($datetime) . $csv->sep() . $csv->quote($title) . $csv->line();
}
}
// close table and div tags
if (!$csv) {
print '
</table>
</div>';
}
}
示例4: foreach
// don't get confused
if ($candelete) {
$found = false;
foreach ($comments as $comment) {
if ($comment->deleted) {
$found = true;
break;
}
}
if ($found) {
print '<p class="ouw_deletedcommentinfo">' . get_string('commentdeletedinfo', 'ouwiki') . '</p>';
}
}
print '<div class="ouwiki_allcomments">';
// OK, display all comments
print ouwiki_display_comments($comments, $section, $pagename, $subwiki, $cm, true, $candelete);
// And 'add comment' form
if ($canpost) {
print '<h2>' . get_string('commentpostheader', 'ouwiki') . '</h2>';
print '<a id="post"></a>';
print ouwiki_display_comment_form('comments', $section, $section ? $knownsections[$section] : null, $pagename, $subwiki, $cm);
}
print '</div>';
// Link to return to page
global $CFG, $THEME;
print '<div class="ouw_returnlink">' . '<span class="sep">' . $THEME->larrow . '</span> ' . '<a href="view.php?' . ouwiki_display_wiki_parameters($pageversion->title, $subwiki, $cm) . '">' . get_string('returntopage', 'ouwiki') . '</a></div>';
// Footer
ouwiki_print_footer($course, $cm, $subwiki, $pagename);
?>
示例5: get_record
// Check permission
$comment = get_record('ouwiki_comments', 'id', $commentid);
$candelete = has_capability('mod/ouwiki:deletecomments', $context);
global $USER;
$owncomment = $comment->userid == $USER->id;
if (!$owncomment && !$candelete) {
error('You do not have permission to delete this comment');
}
$confirmed = optional_param('confirm', 0, PARAM_INT);
// Admin users don't have to confirm delete since they can undelete
if ($candelete || $confirmed) {
// Delete comment
ouwiki_delete_comment($pageversion->pageid, $commentid, $delete);
// Redirect
redirect($url);
} else {
// Display confirm form
$nav = get_string('commentdelete', 'ouwiki');
ouwiki_print_start($ouwiki, $cm, $course, $subwiki, $pagename, $context, array(array('name' => $nav, 'type' => 'ouwiki')), true, true);
print_box_start();
print '<p>' . get_string('commentdeleteconfirm', 'ouwiki') . '</p>';
print '<form action="deletecomment.php" method="post">';
print ouwiki_display_wiki_parameters($pageversion->title, $subwiki, $cm, OUWIKI_PARAMS_FORM);
print '<input type="hidden" name="sesskey" value="' . sesskey() . '" />' . '<input type="hidden" name="comment" value="' . $commentid . '" />' . '<input type="hidden" name="section" value="' . $section . '" />' . '<input type="hidden" name="delete" value="' . $delete . '" />' . '<input type="hidden" name="confirm" value="1" />' . '<input type="submit" name="action" value="' . get_string('commentdelete', 'ouwiki') . '"/> ' . '<input type="submit" name="cancel" value="' . get_string('cancel') . '"/>';
print '</form>';
print_box_end();
ouwiki_print_footer($course, $cm, $subwiki, $pagename);
}
?>
示例6: ouwiki_get_subwiki_missingpages
print '</ul>';
}
$missing = ouwiki_get_subwiki_missingpages($subwiki->id);
if (count($missing) > 0) {
print '<div class="ouw_missingpages"><h2>' . get_string('missingpages', 'ouwiki') . '</h2>';
print '<p>' . get_string(count($missing) > 1 ? 'advice_missingpages' : 'advice_missingpage', 'ouwiki') . '</p>';
print '<ul>';
$first = true;
foreach ($missing as $title => $from) {
print '<li>';
if ($first) {
$first = false;
} else {
print ' • ';
}
print '<a href="view.php?' . ouwiki_display_wiki_parameters($title, $subwiki, $cm) . '">' . htmlspecialchars($title) . '</a> <span class="ouw_missingfrom">(' . get_string(count($from) > 1 ? 'frompages' : 'frompage', 'ouwiki', '<a href="view.php?' . ouwiki_display_wiki_parameters($from[0], $subwiki, $cm) . '">' . ($from[0] ? htmlspecialchars($from[0]) : get_string('startpage', 'ouwiki')) . '</a>)</span>');
print '</li>';
}
print '</ul>';
print '</div>';
}
$tree = 0;
if (!empty($treemode)) {
$wikiparams .= '&type=tree';
$tree = 1;
}
if (count($index) != 0) {
print '<div class="ouw_entirewiki"><h2>' . get_string('entirewiki', 'ouwiki') . '</h2>';
print '<p>' . get_string('onepageview', 'ouwiki') . '</p><ul>';
print '<li id="ouwiki_down_html"><a href="entirewiki.php?' . $wikiparams . '&format=html">' . get_string('format_html', 'ouwiki') . '</a></li>';
// Are there any files in this wiki?
示例7: ouwiki_showtimelines
//.........这里部分代码省略.........
// round the times to the beginning of the day
$mintime -= $mintime % $day;
$maxtime -= $maxtime % $day;
// count the number of days
$daycount = ceil(($maxtime - $mintime) / $day);
// get the page titles
$pages = array_keys($timeline);
// for each page initialise every date to 0 edits
foreach ($pages as $page) {
// go from first edit date by user group on wiki to last edit date, a day at a time
for ($time = $mintime; $time <= $maxtime; $time += $day) {
// get the date
$date = userdate($time, get_string('strftimedate'));
// inititilise the data point to 0 edits
$timeline[$page][$date] = 0;
}
}
// init the maximum edits in a single day for scale
$maxeditcount = 0;
// for each edited page version count the number of edits for each page for each day
foreach ($editpagetimes as $editpagetime) {
// get the page title
$page = $editpagetime->pagetitle;
// get the edit date
$date = userdate($editpagetime->date, get_string('strftimedate'));
// increment the number of times the page has been edited on this date
$timeline[$page][$date]++;
// check for maximum edits in a single day
$maxeditcount = max($maxeditcount, $timeline[$page][$date]);
}
// get min and max dates for edits by user group in wiki
$mindate = userdate($mintime, get_string('strftimedate'));
$maxdate = userdate($maxtime, get_string('strftimedate'));
// Don't show it if there's nothing in it
if (count($timeline) == 0) {
return;
}
// print opening div and table tags as well as headers, the first header is the page name and link to the page
// and the second contains the first and last date of editing
if (!$csv) {
print <<<EOF
<div class="ouw_timelines_page">
<h3>{$header->timelinetitle}</h3>
<table>
<tr>
<th scope="col">{$header->timelinepage}<div class='ouw_pagecolumn'></div></th>
<th class="ouw_firstingroup" scope="col">{$mindate}</th><th class='ouw_rightcol ouw_lastdate' scope="col">{$maxdate}</th>
\t </tr>
EOF;
} else {
print $csv->line() . $csv->quote($header->timelinetitle) . $csv->line() . $csv->quote($header->timelinepage);
$data = reset($timeline);
foreach ($data as $date => $datum) {
print $csv->sep() . $csv->quote($date);
}
}
// Draw the graphs
// for each timeline for each page
$count = count($timeline);
foreach ($timeline as $pagetitle => $data) {
// if no title then must be start page of wiki, create link to this
if ($pagetitle === '') {
// get the parameters to view the subwiki pages
$pageparams = ouwiki_display_wiki_parameters(null, $subwiki, $cm);
// create a link to the page
$pagelink = "<a href='view.php?" . $pageparams . "'>" . get_string('startpage', 'ouwiki') . "</a>";
} else {
// get the page params to link to the page
$pageparams = ouwiki_display_wiki_parameters($pagetitle, $subwiki, $cm);
// create a link to the page
$pagelink = "<a href='view.php?" . $pageparams . "'>" . htmlspecialchars($pagetitle) . "</a>";
}
// print the title and link to the page
$count--;
if (!$csv) {
print "\n \t<tr" . ($count == 0 ? " class='ouw_lastrow'" : "") . ">\n <td class='ouw_leftcol'>{$pagelink}</td>\n <td class='ouw_rightcol ouw_firstingroup' colspan='2'>";
// print the bar chart for the page timeline data, max edit count is for an even scale,
// the numbers are the size of each graph => width, height
barchart($data, 800, 20, $maxeditcount);
// close the tags for the row
print "\n \t\t<div class='clearer'></div></td>\n \t</tr>";
} else {
if ($pagetitle === '') {
$pagetitle = get_string('startpage', 'ouwiki');
}
print $csv->line() . $csv->quote(htmlspecialchars($pagetitle));
foreach ($data as $date => $datum) {
print $csv->sep() . $csv->quote($datum);
}
}
}
// close the table and div tags for the timeline data
if (!$csv) {
print '
</table>
</div>';
} else {
print $csv->line();
}
}
示例8: date
<link>' . $pagelink . '</link>
<pubDate>' . date('r', reset($changes)->timecreated) . '</pubDate>';
} else {
print '
<feed xmlns="http://www.w3.org/2005/Atom">
<link rel="self" href="' . $feedlink . '"/>
<link rel="alternate" type="text/html" href="' . $pagelink . '"/>
<title>' . $feedtitle . '</title>
<subtitle>' . $feeddescription . '</subtitle>
<updated>' . date('c', reset($changes)->timecreated) . '</updated>
<author>
<name>Wiki system</name>
</author>
<id>' . $id . '</id>';
}
$pageparams = ouwiki_display_wiki_parameters($pagename, $subwiki, $cm);
foreach ($changes as $change) {
$a = new StdClass();
$a->name = htmlspecialchars(fullname($change));
if ($change->versionid == $pageversion->versionid) {
$itemlink = $CFG->wwwroot . '/mod/ouwiki/view.php?' . $pageparams;
} else {
$itemlink = $CFG->wwwroot . '/mod/ouwiki/viewold.php?' . $pageparams . '&version=' . $change->versionid;
}
$itemtitle = $ouwiki->name . ' - ' . $pagetitle . ' (' . ouwiki_nice_date($change->timecreated) . ')';
$nextchange = next($changes);
if ($nextchange) {
$a->url = $CFG->wwwroot . '/mod/ouwiki/diff.php?' . $pageparams . '&v1=' . $nextchange->versionid . '&v2=' . $change->versionid;
$a->main = get_string('feedchange', 'ouwiki', $a);
} else {
$a->main = get_string('feednewpage', 'ouwiki', $a);
示例9: ouwiki_get_annotate_link
/**
* Get html for the annotate link.
*
* @param string $str
* @param string $pagename
* @param object $subwiki
* @param object $cm
* @param string $xhtmlid
* @return string
*/
public function ouwiki_get_annotate_link($pagename, $subwiki, $cm)
{
global $CFG;
return ' ' . html_writer::tag('a', get_string('annotate', 'ouwiki'), array('href' => $CFG->wwwroot . '/mod/ouwiki/annotate.php?' . ouwiki_display_wiki_parameters($pagename, $subwiki, $cm, OUWIKI_PARAMS_URL), 'class' => 'ouw_annotate'));
}
示例10: dirname
require_once dirname(__FILE__) . '/../../config.php';
require_once $CFG->dirroot . '/local/ousearch/searchlib.php';
require $CFG->dirroot . '/mod/ouwiki/basicpage.php';
$querytext = required_param('query', PARAM_RAW);
$url = new moodle_url('/mod/ouwiki/search.php', array('id' => $id, 'user' => $userid, 'query' => $querytext));
$PAGE->set_url($url);
$ouwikioutput = $PAGE->get_renderer('mod_ouwiki');
echo $ouwikioutput->ouwiki_print_start($ouwiki, $cm, $course, $subwiki, get_string('searchresults'), $context, null, null, null, '', '', $querytext);
echo html_writer::start_div();
$query = new local_ousearch_search($querytext);
$query->set_coursemodule($cm);
if ($subwiki->groupid) {
$query->set_group_id($subwiki->groupid);
}
if ($subwiki->userid) {
$query->set_user_id($subwiki->userid);
}
$foundsomething = $query->display_results('search.php?' . ouwiki_display_wiki_parameters('', $subwiki, $cm));
echo $foundsomething;
// Add link to search the rest of this website if service available.
if (!empty($CFG->block_resources_search_baseurl)) {
$params = array('course' => $course->id, 'query' => $querytext);
$restofwebsiteurl = new moodle_url('/blocks/resources_search/search.php', $params);
$strrestofwebsite = get_string('restofwebsite', 'local_ousearch');
$altlink = html_writer::start_tag('div', array('class' => 'advanced-search-link'));
$altlink .= html_writer::link($restofwebsiteurl, $strrestofwebsite);
$altlink .= html_writer::end_tag('div');
print $altlink;
}
// Footer
ouwiki_print_footer($course, $cm, $subwiki, null, 'search.php?query=' . urlencode($querytext), $foundsomething ? null : 'searchfailure', $querytext);
示例11: reportssummary_editedpagetable
/**
* This prints a table showing the info about each page including the name of the page with a link to the page;
* the number of contributors, edits, comments, intensity; the number of edits and comments by role;
* the date of the first and last edits; the number of words and number of links to the page.
*
* @param object $subwiki the subwiki id
* @param object $cm
* @param int $viewgroupid the group id
* @param object $header the header text object
* @param unknown_type $pagesinfo the title, first day of editing, last day and text of each page
* @param array $rolenames the array of role names
* @param unknown_type $pageeditcount the array of edit counts for each page
* @param unknown_type $editsbyroles the array of edit counts for each role
* @param unknown_type $pagecontributorcount the number of contributors on each page
* @param int $totalusers the total number of users
* @param unknown_type $pagecommentcount the number of comments on each page
* @param unknown_type $commentsbyroles the number of comments by each role
*/
function reportssummary_editedpagetable($contexts, $subwiki, $cm, $viewgroupid, $header, $pagesinfo, $rolenames, $pageeditcount, $editsbyroles, $pagecontributorcount, $totalusers, $pagecommentcount, $commentsbyroles, $csv)
{
// list of edited pages table
// get the data from the database
// get the number of pages that link to the each page
$pagelinks = ouwiki_get_pagelinks($subwiki->id);
// get the collaboration intensity
$collabintensity = ouwiki_get_collaborationintensity($contexts, $subwiki->id, $viewgroupid);
// this function prints out the first two header rows of the table
reportssummary_editedpagetableheaders($header, $rolenames, $csv);
// for each page in the subwiki, use the info to display a row of data
foreach ($pagesinfo as $pageid => $pageinfo) {
// get the page title
$title = $pageinfo->title;
// get total number of edits on page
$editcount = $pageeditcount[$title];
// get total number of conrtributors for page
$contributorcount = $pagecontributorcount[$title];
// calc percentage of contributers from all users
$contribpercent = $totalusers != 0 ? round($contributorcount / $totalusers * 100, 1) : 0;
// get the number of total comments on the page
$commentcount = $pagecommentcount[$title];
// calc the number of words in the page text
$wordcount = str_word_count(strip_tags($pageinfo->text));
// get the first day of editing on the page
$startday = userdate($pageinfo->startday, get_string('strftimedate'));
// get the last day of editing on the page
$lastday = userdate($pageinfo->lastday, get_string('strftimedate'));
// get the number of links to the page
$linkcount = isset($pagelinks[$pageid]) ? $pagelinks[$pageid]->linkcount : 0;
// get the page params to link to the page
$pageparams = ouwiki_display_wiki_parameters($title, $subwiki, $cm);
// create a link to the page
$pagelink = "<a href='view.php?" . $pageparams . "'>" . htmlspecialchars($title) . "</a>";
// if no title then must be start page of wiki, create link to this
if ($title === null) {
// get the parameters to view the subwiki pages
$pageparams = ouwiki_display_wiki_parameters(null, $subwiki, $cm);
$pagelink = "<a href='view.php?" . $pageparams . "'>" . get_string('startpage', 'ouwiki') . "</a>";
}
// get the collaboration intensity
$collaboration = isset($collabintensity[$pageid]) ? $collabintensity[$pageid] : ($editcount ? 0 : '');
// start the row of data in the table for the current page and print the first four bits of info:
// page name and link, contributor count with percentage, edit count and comment count
if (!$csv) {
print "\n <tr>\n \t<td class='ouw_leftcol'>{$pagelink}</td>\n \t<td>{$contributorcount} ({$contribpercent}%)</td> \t\t\t\n \t<td>{$editcount}</td>\n \t<td>{$commentcount}</td> \t\t\t\n \t<td class='ouw_datecolumn'>{$startday}</td>\n \t<td class='ouw_datecolumn'>{$lastday}</td>\n \t<td>{$wordcount}</td>\n \t<td>{$linkcount}</td>\n \t<td>{$collaboration}</td>\n \t";
} else {
if ($title === null) {
$title = get_string('startpage', 'ouwiki');
}
print $csv->quote(htmlspecialchars($title)) . $csv->sep() . $csv->quote($contributorcount . ' (' . $contribpercent . '%)') . $csv->sep() . $csv->quote($editcount) . $csv->sep() . $csv->quote($commentcount) . $csv->sep() . $csv->quote($startday) . $csv->sep() . $csv->quote($lastday) . $csv->sep() . $csv->quote($wordcount) . $csv->sep() . $csv->quote($linkcount) . $csv->sep() . $csv->quote($collaboration) . $csv->sep();
}
// for each role name, print the info for that role: edits, comments and intensity
$count = count($rolenames);
foreach ($rolenames as $roleid => $rolename) {
$count--;
$endornot = $count ? '' : ' class="ouw_rightcol"';
// get the number of edits by current role
$editsbyrole = $editsbyroles[$roleid];
$roleeditcount = isset($editsbyrole[$pageid]) ? $editsbyrole[$pageid]->editcount : 0;
// get the number of comments by role
$commentsbyrole = $commentsbyroles[$roleid];
$rolecommentcount = isset($commentsbyrole[$pageid]) ? $commentsbyrole[$pageid]->commentcount : 0;
// print the 3 data columns for the role name: edits, comments and collaboration
if (!$csv) {
print "\n \t\t<td class='ouw_firstingroup'>{$roleeditcount}</td>\n \t\t<td{$endornot}>{$rolecommentcount}</td>\n \t\t";
} else {
print $csv->quote($roleeditcount) . $csv->sep() . $csv->quote($rolecommentcount) . $csv->sep();
}
}
// print the data columns for the current page: first day of editing,
// last day of editing, word count and number of links
if (!$csv) {
print " \t\t\t\n \t\t</tr>\n \t\t";
} else {
print $csv->line();
}
}
// close the table and div tags
$strintensityexplanation = get_string('report_intensityexplanation', 'ouwiki');
if (!$csv) {
print "\n\t</table>\n\t<p><small>\n\t * {$strintensityexplanation}\n\t</small></p>\n</div>\n";
//.........这里部分代码省略.........
示例12: ouwiki_display_create_page_form
/**
* @param object $subwiki For details of user/group and ID so that
* we can make links
* @param object $cm Course-module object (again for making links)
* @param object $pageversion Data from page and version tables.
* @return string HTML content for page
*/
function ouwiki_display_create_page_form($subwiki, $cm, $pageversion)
{
$result = '';
$genericformdetails = '<form method="get" action="edit.php">
<div class="ouwiki_addnew_div">
<input type="hidden" name="originalpagename" value="' . $pageversion->title . '" />
' . ouwiki_display_wiki_parameters($pageversion->title, $subwiki, $cm, $type = OUWIKI_PARAMS_FORM);
$result .= '<div id="ouwiki_addnew"><ul>
<li>
' . $genericformdetails . '
' . get_string('addnewsection', 'ouwiki') . '
<input type="text" size="30" name="newsectionname" id="ouw_newsectionname" value="' . get_string('typeinsectionname', 'ouwiki') . '" />
<input type="submit" id="ouw_add" name="ouw_subb" value="' . get_string('add', 'ouwiki') . '" />
</div>
</form>
</li>
<li>
' . $genericformdetails . '
' . get_string('createnewpage', 'ouwiki') . '
<input type="text" name="page" id="ouw_newpagename" size="30" value="' . get_string('typeinpagename', 'ouwiki') . '" />
<input type="submit" id="ouw_create" name="ouw_subb" value="' . get_string('create', 'ouwiki') . '" />
</div>
</form>
</li>
</ul>
</div>';
return $result;
}
示例13: require_login
//
// Moodle is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
/**
* Toggles the controls whether to load HQ videos or SQ videos for this user
* @package mod_ouwiki
* @copyright 2012 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
require '../../config.php';
require $CFG->dirroot . '/mod/ouwiki/basicpage.php';
require_login();
require_sesskey();
$hide = required_param('hide', PARAM_INT);
if ($hide) {
set_user_preference(OUWIKI_PREF_HIDEANNOTATIONS, 1);
} else {
unset_user_preference(OUWIKI_PREF_HIDEANNOTATIONS);
}
// If this is the AJAX version, stop processing now.
if (optional_param('ajax', 0, PARAM_INT)) {
exit;
}
// Otherwise redirect back.
redirect('view.php?' . ouwiki_display_wiki_parameters($pagename, $subwiki, $cm, OUWIKI_PARAMS_URL));
示例14: error
if (!preg_match('/^[0-9]+_[0-9]+$/', $section)) {
$section = null;
}
if ($section) {
if (!array_key_exists($section, $knownsections)) {
error("Unknown section {$section}");
}
$sectiontitle = $knownsections[$section];
}
// Get other parameters
$fromphp = required_param('fromphp', PARAM_RAW);
$title = stripslashes(required_param('title', PARAM_RAW));
$xhtml = stripslashes(required_param('xhtml', PARAM_CLEAN));
// Work out redirect url
if ($fromphp == 'view') {
$url = 'view.php?' . ouwiki_display_wiki_parameters($pagename, $subwiki, $cm, OUWIKI_PARAMS_URL) . '&showcomments' . ($section ? '#ouw_s' . $section : '');
} else {
$url = 'comments.php?' . ouwiki_display_wiki_parameters($pagename, $subwiki, $cm, OUWIKI_PARAMS_URL) . ($section ? '§ion=' . $section : '');
}
if ('' == preg_replace('/(<.*?>)|( )|\\s/', '', $xhtml)) {
error(get_string('commentblank', 'ouwiki'), $url);
}
// Check post permission
require_capability('mod/ouwiki:comment', $context);
// Add post
ouwiki_add_comment($pageversion->pageid, $section, $section ? $sectiontitle : null, $title, $xhtml);
// Redirect
redirect($url);
?>
示例15: print_error
print_error('invalidcoursemodule');
}
$PAGE->set_cm($cm);
// When creating a new page, do some checks
$addpage = false;
if (!is_null($frompage)) {
$urlparams['frompage'] = $frompage;
$returnurl = new moodle_url('/mod/ouwiki/view.php', ouwiki_display_wiki_parameters($frompage, $subwiki, $cm, OUWIKI_PARAMS_ARRAY));
if (trim($pagename) === '') {
print_error('emptypagetitle', 'ouwiki', $returnurl);
}
// Strip whitespace from new page name from form (editor does this for other links).
$pagename = preg_replace('/\\s+/', ' ', $pagename);
$addpage = true;
}
$returnurl = new moodle_url('/mod/ouwiki/view.php', ouwiki_display_wiki_parameters($pagename, $subwiki, $cm, OUWIKI_PARAMS_ARRAY));
// When creating a section, do checks
$addsection = false;
if (!is_null($newsection)) {
if (trim($newsection) === '') {
print_error('emptysectiontitle', 'ouwiki', $returnurl);
}
$addsection = true;
}
$context = context_module::instance($cm->id);
$PAGE->set_pagelayout('incourse');
require_course_login($course, true, $cm);
$ouwikioutput = $PAGE->get_renderer('mod_ouwiki');
require_capability('mod/ouwiki:edit', $context);
$url = new moodle_url('/mod/ouwiki/edit.php', $urlparams);
$PAGE->set_url($url);