public function apply($discussion, $all, $selected, $formdata) { global $COURSE, $USER, $CFG, $PAGE; $d = $discussion->get_id(); $forum = $discussion->get_forum(); $PAGE->set_pagelayout('embedded'); $out = mod_forumng_utils::get_renderer(); print $out->header(); $backlink = new moodle_url('/mod/forumng/discuss.php', $discussion->get_link_params_array()); print html_writer::start_tag('div', array('class' => 'forumng-printable-header')); print html_writer::tag('div', link_arrow_left($discussion->get_subject(), $backlink), array('class' => 'forumng-printable-backlink')); print html_writer::tag('div', get_string('printedat', 'forumngfeature_print', userdate(time())), array('class' => 'forumng-printable-date')); print html_writer::tag('div', '', array('class' => 'clearer')); print "\n"; print $out->box(get_string('back', 'forumngfeature_print', $backlink->out()), 'generalbox forumng-donotprint'); print html_writer::start_tag('div', array('class' => 'forumng-showprintable')); if ($all) { print $out->render_discussion($discussion, array(mod_forumng_post::OPTION_NO_COMMANDS => true, mod_forumng_post::OPTION_CHILDREN_EXPANDED => true, mod_forumng_post::OPTION_PRINTABLE_VERSION => true)); } else { $allhtml = ''; $alltext = ''; $discussion->build_selected_posts_email($selected, $alltext, $allhtml, array(mod_forumng_post::OPTION_PRINTABLE_VERSION)); print $allhtml; } print html_writer::end_tag('div'); $forum->print_js(0, false); print $out->footer(); }
function apply($discussion, $all, $selected, $formdata) { global $COURSE, $USER, $CFG; $d = $discussion->get_id(); $forum = $discussion->get_forum(); print_header($this->get_page_name()); $printablebacklink = $CFG->wwwroot . '/mod/forumng/discuss.php?' . $discussion->get_link_params(forum::PARAM_HTML); print ' <div class="forumng-printable-header"> <div class="forumng-printable-backlink">' . link_arrow_left($discussion->get_subject(), $printablebacklink) . '</div> <div class="forumng-printable-date">' . get_string('printedat', 'forumng', userdate(time())) . '</div> <div class="clearer"></div></div>' . "\n" . '<div class="forumng-showprintable">'; if ($all) { print $forum->get_type()->display_discussion($discussion, array(forum_post::OPTION_NO_COMMANDS => true, forum_post::OPTION_CHILDREN_EXPANDED => true, forum_post::OPTION_PRINTABLE_VERSION => true)); } else { $allhtml = ''; $alltext = ''; $discussion->build_selected_posts_email($selected, $alltext, $allhtml, true, true); print $allhtml; } print "</div>"; $forum->print_js(0, true); print "\n</body>\n<html>"; }
/** * Build and return a previous month HTML link, with an arrow. * @param string $text The text label. * @param string $linkbase The URL stub. * @param int $d $m $y Day of month, month and year numbers. * @param bool $accesshide Default visible, or hide from all except screenreaders. * @return string HTML string. */ function calendar_get_link_previous($text, $linkbase, $d, $m, $y, $accesshide = false) { $href = calendar_get_link_href($linkbase, $d, $m, $y); if (empty($href)) { return $text; } return link_arrow_left($text, $href, $accesshide, 'previous'); }
} } else { $numberofdiscussions = count($user->discussionids); if ($numberofdiscussions > 0) { $numberofdiscussions = ($numberofdiscussions == 1 ? get_string("numberofdiscussion", "forumng", $numberofdiscussions) : get_string("numberofdiscussions", "forumng", $numberofdiscussions)) . '<br />'; } else { $numberofdiscussions = ''; } $grouplist = ''; if (count($user->groupids)) { foreach ($user->groupids as $id) { $grouplist .= groups_get_group_name($id) . '<br />'; } } } $row[] = $numberofdiscussions . $grouplist; } if ($user->link) { $table->data[] = $row; } } print html_writer::table($table); if ($canmanage) { if ($gotsome) { print '<div id="forumng-buttons"><input type="submit" ' . 'name="unsubscribe" value="' . get_string('unsubscribeselected', 'forumng') . '" /></div>'; } print '</div></form>'; } } print link_arrow_left($forum->get_name(), $forum->get_url(mod_forumng::PARAM_HTML)); print $out->footer($course);
/** * Build and return a previous month HTML link, with an arrow. * * @param string $text The text label. * @param string|moodle_url $linkbase The URL stub. * @param int $d The number of the date. * @param int $m The number of the month. * @param int $y year The number of the year. * @param bool $accesshide Default visible, or hide from all except screenreaders. * @param int $time the unixtime, used for multiple calendar support. The values $d, * $m and $y are kept for backwards compatibility. * @return string HTML string. */ function calendar_get_link_previous($text, $linkbase, $d, $m, $y, $accesshide = false, $time = 0) { $href = calendar_get_link_href(new moodle_url($linkbase), $d, $m, $y, $time); if (empty($href)) { return $text; } return link_arrow_left($text, (string) $href, $accesshide, 'previous'); }
public function display_link_back_to_forum() { // Print link back to discussion list print '<div id="forumng-arrowback">' . link_arrow_left($this->get_forum()->get_name(), 'view.php?' . $this->get_forum()->get_link_params(mod_forumng::PARAM_HTML)) . '</div>'; }
$showallpostsby = "<a href='{$url}'>{$showallpostsby}</a>"; } $row[0] = $span . $username . "</span>"; $row[1] = $span . $numberofdiscussions . "</span>"; $row[2] = $span . $numberofreplies . "</span>"; $row[3] = $span . $showallpostsby . "</span>"; $data[] = $row; } // Setup the table layout $user = get_string('user', 'forumng'); $discussions = get_string('discussions', 'forumng'); $replies = get_string('replies', 'forumng'); $action = get_string('action', 'forumng'); $table = new object(); $table->head = array($user, $discussions, $replies, "<span class='accesshide'>{$action}</span>"); $table->size = array('30%', '10%', '10%', '40%'); $table->align = array('left', 'right', 'right', 'left'); $table->width = '90%'; $table->data = $data; // Display the table print "<div class='forumng-userpoststable'>"; print_table($table); print '</div>'; // Display link to the discussion $url = '../../view.php?id=' . $cmid; print link_arrow_left($forum->get_name(), $url); // Display footer print_footer($course); } catch (forum_exception $e) { forum_utils::handle_exception($e); }
/** * Given a course and a (current) coursemodule * This function returns a small popup menu with all the * course activity modules in it, as a navigation menu * The data is taken from the serialised array stored in * the course record * * @param course $course A {@link $COURSE} object. * @param course $cm A {@link $COURSE} object. * @param string $targetwindow ? * @return string * @todo Finish documenting this function */ function navmenu($course, $cm = NULL, $targetwindow = 'self') { global $CFG, $THEME, $USER, $DB; require_once $CFG->dirroot . '/course/lib.php'; // Required for get_fast_modinfo if (empty($THEME->navmenuwidth)) { $width = 50; } else { $width = $THEME->navmenuwidth; } if ($cm) { $cm = $cm->id; } if ($course->format == 'weeks') { $strsection = get_string('week'); } else { $strsection = get_string('topic'); } $strjumpto = get_string('jumpto'); $modinfo = get_fast_modinfo($course); $context = get_context_instance(CONTEXT_COURSE, $course->id); $section = -1; $selected = ''; $url = ''; $previousmod = NULL; $backmod = NULL; $nextmod = NULL; $selectmod = NULL; $logslink = NULL; $flag = false; $menu = array(); $menustyle = array(); $sections = $DB->get_records('course_sections', array('course' => $course->id), 'section', 'section,visible,summary'); if (!empty($THEME->makenavmenulist)) { /// A hack to produce an XHTML navmenu list for use in themes $THEME->navmenulist = navmenulist($course, $sections, $modinfo, $strsection, $strjumpto, $width, $cm); } foreach ($modinfo->cms as $mod) { if ($mod->modname == 'label') { continue; } if ($mod->sectionnum > $course->numsections) { /// Don't show excess hidden sections break; } if (!$mod->uservisible) { // do not icnlude empty sections at all continue; } if ($mod->sectionnum > 0 and $section != $mod->sectionnum) { $thissection = $sections[$mod->sectionnum]; if ($thissection->visible or !$course->hiddensections or has_capability('moodle/course:viewhiddensections', $context)) { $thissection->summary = strip_tags(format_string($thissection->summary, true)); if ($course->format == 'weeks' or empty($thissection->summary)) { $menu[] = '--' . $strsection . " " . $mod->sectionnum; } else { if (strlen($thissection->summary) < $width - 3) { $menu[] = '--' . $thissection->summary; } else { $menu[] = '--' . substr($thissection->summary, 0, $width) . '...'; } } $section = $mod->sectionnum; } else { // no activities from this hidden section shown continue; } } $url = $mod->modname . '/view.php?id=' . $mod->id; if ($flag) { // the current mod is the "next" mod $nextmod = $mod; $flag = false; } $localname = $mod->name; if ($cm == $mod->id) { $selected = $url; $selectmod = $mod; $backmod = $previousmod; $flag = true; // set flag so we know to use next mod for "next" $localname = $strjumpto; $strjumpto = ''; } else { $localname = strip_tags(format_string($localname, true)); $tl = textlib_get_instance(); if ($tl->strlen($localname) > $width + 5) { $localname = $tl->substr($localname, 0, $width) . '...'; } if (!$mod->visible) { $localname = '(' . $localname . ')'; } } $menu[$url] = $localname; if (empty($THEME->navmenuiconshide)) { $menustyle[$url] = 'style="background-image: url(' . $CFG->modpixpath . '/' . $mod->modname . '/icon.gif);"'; // Unfortunately necessary to do this here } $previousmod = $mod; } //Accessibility: added Alt text, replaced > < with 'silent' character and 'accesshide' text. if ($selectmod and has_capability('coursereport/log:view', $context)) { $logstext = get_string('alllogs'); $logslink = '<li>' . "\n" . '<a title="' . $logstext . '" ' . $CFG->frametarget . 'onclick="this.target=\'' . $CFG->framename . '\';"' . ' href="' . $CFG->wwwroot . '/course/report/log/index.php?chooselog=1&user=0&date=0&id=' . $course->id . '&modid=' . $selectmod->id . '">' . '<img class="icon log" src="' . $CFG->pixpath . '/i/log.gif" alt="' . $logstext . '" /></a>' . "\n" . '</li>'; } if ($backmod) { $backtext = get_string('activityprev', 'access'); $backmod = '<li><form action="' . $CFG->wwwroot . '/mod/' . $backmod->modname . '/view.php" ' . 'onclick="this.target=\'' . $CFG->framename . '\';"' . '><fieldset class="invisiblefieldset">' . '<input type="hidden" name="id" value="' . $backmod->id . '" />' . '<button type="submit" title="' . $backtext . '">' . link_arrow_left($backtext, $url = '', $accesshide = true) . '</button></fieldset></form></li>'; } if ($nextmod) { $nexttext = get_string('activitynext', 'access'); $nextmod = '<li><form action="' . $CFG->wwwroot . '/mod/' . $nextmod->modname . '/view.php" ' . 'onclick="this.target=\'' . $CFG->framename . '\';"' . '><fieldset class="invisiblefieldset">' . '<input type="hidden" name="id" value="' . $nextmod->id . '" />' . '<button type="submit" title="' . $nexttext . '">' . link_arrow_right($nexttext, $url = '', $accesshide = true) . '</button></fieldset></form></li>'; } return '<div class="navigation">' . "\n" . '<ul>' . $logslink . $backmod . '<li>' . popup_form($CFG->wwwroot . '/mod/', $menu, 'navmenupopup', $selected, $strjumpto, '', '', true, $targetwindow, '', $menustyle) . '</li>' . $nextmod . '</ul>' . "\n" . '</div>'; }
if ($svgcleverness) { $PAGE->requires->yui_lib('event'); $PAGE->requires->js('course/report/progress/textrotate.js'); } // Handle groups (if enabled) groups_print_course_menu($course, $CFG->wwwroot . '/course/report/progress/?course=' . $course->id); } // Do we need a paging bar? if ($progress->total > COMPLETION_REPORT_PAGE) { $pagingbar = '<div class="completion_pagingbar">'; if ($start > 0) { $newstart = $start - COMPLETION_REPORT_PAGE; if ($newstart < 0) { $newstart = 0; } $pagingbar .= link_arrow_left(get_string('previous'), './?course=' . $course->id . ($newstart ? '&start=' . $newstart : ''), false, 'completion_prev'); } $a = new StdClass(); $a->from = $start + 1; $a->to = $start + COMPLETION_REPORT_PAGE; $a->total = $progress->total; $pagingbar .= '<p>' . get_string('reportpage', 'completion', $a) . '</p>'; if ($start + COMPLETION_REPORT_PAGE < $progress->total) { $pagingbar .= link_arrow_right(get_string('next'), './?course=' . $course->id . '&start=' . ($start + COMPLETION_REPORT_PAGE), false, 'completion_next'); } $pagingbar .= '</div>'; } else { $pagingbar = ''; } // Okay, let's draw the table of progress info, // Start of table
/** * User interface helper code that prints out the results from a search. * Normally called by ousearch_display_results, but provided in case other * code wants to mimmick that appearance. * @param object $results Results object with fields ->success (if false, * also set ->problemword to indicate the word causing the failure) and * ->results (an array). Each element in ->results has fields ->title (HTML, * may additionally include <highlight> tags), ->summary (ditto) and * ->url (URL, not escaped) * @param string $title Heading for search results (HTML) * @param int $number Number of first result (default 1) * @param string $prevlink URL (not escaped) of link to previous results page, * if any * @param string $prevrange Range of results on previous page e.g. '1-10' * @param string $nextlink URL (not escaped) of link to next results page, * if any * @param float $searchtime Search time as floating-point number of seconds * @return string HTML code to print out */ public static function format_results($results, $title, $number = 1, $prevlink = null, $prevrange = null, $nextlink = null, $searchtime = null) { $out = '<div class="ousearch_results">'; if ($title !== '') { $out .= '<h2>' . $title . '</h2>'; } if (!$results->success) { if ($results->problemword === null) { $out .= '<p>' . get_string('nowordsinquery', 'local_ousearch') . '</p>'; } else { $out .= '<p>' . get_string('resultsfail', 'local_ousearch', $results->problemword) . '</p>'; } } else { if ($prevlink) { $out .= '<p>' . link_arrow_left(get_string('previousresults', 'local_ousearch', $prevrange), $prevlink, false, 'left') . '</p>'; } if (count($results->results) == 0) { $out .= '<p>' . get_string($prevlink ? 'nomoreresults' : 'noresults', 'local_ousearch') . '</p>'; } else { $out .= '<ul>'; foreach ($results->results as $result) { $title = $result->title === '' ? get_string('untitled', 'local_ousearch') : $result->title; $out .= '<li>'; $out .= '<h3><a href="' . $result->url . '">' . str_replace('highlight>', 'strong>', $title) . '</a></h3>' . '<div class="ous_summary">' . str_replace('highlight>', 'strong>', $result->summary) . '</div></li>'; $number++; } $out .= '</ul>'; } if ($nextlink) { $out .= '<p>' . link_arrow_right(get_string('findmoreresults', 'local_ousearch'), $nextlink, false, 'right') . '</p>'; } } if ($searchtime !== null) { $out .= '<p class="ous_searchtime">' . get_string('searchtime', 'local_ousearch', round($searchtime, 1)) . '</p>'; } $out .= '</div>'; return $out; }
/** * Creates the navigation links/buttons at the bottom of the reivew attempt page. * * Note, the name of this function is no longer accurate, but when the design * changed, it was decided to keep the old name for backwards compatibility. * * @param quiz_attempt $attemptobj instance of quiz_attempt * @param int $page the current page * @param bool $lastpage if true current page is the last page * @param bool|null $showall if true, the URL will be to review the entire attempt on one page, * and $page will be ignored. If null, a sensible default will be chosen. * * @return string HTML fragment. */ public function review_next_navigation(quiz_attempt $attemptobj, $page, $lastpage, $showall = null) { $nav = ''; if ($page > 0) { $nav .= link_arrow_left(get_string('navigateprevious', 'quiz'), $attemptobj->review_url(null, $page - 1, $showall), false, 'mod_quiz-prev-nav'); } if ($lastpage) { $nav .= $this->finish_review_link($attemptobj); } else { $nav .= link_arrow_right(get_string('navigatenext', 'quiz'), $attemptobj->review_url(null, $page + 1, $showall), false, 'mod_quiz-next-nav'); } return html_writer::tag('div', $nav, array('class' => 'submitbtns')); }
} // Check permission - Allow anyone with delete page capability to view a deleted page version $candelete = has_capability('mod/ouwiki:deletepage', $context); if (!empty($pageversion->deletedat) && !$candelete) { print_error('viewdeletedversionerrorcapability', 'ouwiki'); } // Get previous and next versions $prevnext = ouwiki_get_prevnext_version_details($pageversion); // Get basic wiki parameters $wikiparams = ouwiki_display_wiki_parameters($pagename, $subwiki, $cm); $tabhistparams = ouwiki_shared_url_params($pagename, $subwiki, $cm); echo $ouwikioutput->ouwiki_print_start($ouwiki, $cm, $course, $subwiki, $pagename, $context, array(array('name' => get_string('tab_history', 'ouwiki'), 'link' => new moodle_url('/mod/ouwiki/history.php', $tabhistparams)), array('name' => get_string('oldversion', 'ouwiki'), 'link' => null)), true, true); // Information box if ($prevnext->prev) { $date = ouwiki_nice_date($prevnext->prev->timecreated); $prev = link_arrow_left(get_string('previousversion', 'ouwiki', $date), "viewold.php?{$wikiparams}&version={$prevnext->prev->versionid}"); } else { $prev = ''; } if ($prevnext->next) { if ($prevnext->next->versionid == $pageversion->currentversionid) { $date = get_string('currentversion', 'ouwiki'); $next = link_arrow_right(get_string('nextversion', 'ouwiki', $date), "view.php?{$wikiparams}"); } else { $date = ouwiki_nice_date($prevnext->next->timecreated); $next = link_arrow_right(get_string('nextversion', 'ouwiki', $date), "viewold.php?{$wikiparams}&version={$prevnext->next->versionid}"); } } else { $next = ''; } $date = userdate($pageversion->timecreated);
// see bug #3611 if (!empty($current) && !empty($CFG->ouwikienablecurrentpagehighlight)) { // current page so add accessibility stuff $accessiblityhide = '<span class="accesshide">' . get_string('currentversionof', 'ouwiki') . '</span>'; $dummy = $page; $page = $accessiblityhide . $dummy; } print "\n<tr{$current}>\n <td class='ouw_leftcol'>{$date}</td><td>{$time}</td><td>{$page}</td>\n {$actions}\n <td class='ouw_rightcol'>{$userlink}</td>\n</tr>"; } print '</table>'; if ($count > OUWIKI_PAGESIZE || $from > 0) { print '<div class="ouw_paging"><div class="ouw_paging_prev"> '; if ($from > 0) { $jump = $from - OUWIKI_PAGESIZE; if ($jump < 0) { $jump = 0; } print link_arrow_left(get_string('previous', 'ouwiki'), 'wikihistory.php?' . $tabparams . ($jump > 0 ? '&from=' . $jump : '')); } print '</div><div class="ouw_paging_next">'; if ($count > OUWIKI_PAGESIZE) { $jump = $from + OUWIKI_PAGESIZE; print link_arrow_right(get_string('next', 'ouwiki'), 'wikihistory.php?' . $tabparams . ($jump > 0 ? '&from=' . $jump : '')); } print ' </div></div>'; } $a->atom = $atomurl; $a->rss = $rssurl; print '<p class="ouw_subscribe"><a href="' . $atomurl . '" title="' . get_string('feedalt', 'ouwiki') . '"><img src="' . $CFG->pixpath . '/i/rss.gif" alt=""/></a> <span>' . get_string('feedsubscribe', 'ouwiki', $a) . '</span></p>'; // Footer ouwiki_print_footer($course, $cm, $subwiki);
} $pagename = fullname($user, has_capability('moodle/site:viewfullnames', $context)); $pagename .= $CFG->forumng_showusername ? ' (' . $user->username . ')' : ''; $prevpage = get_string('userposts', 'forumngfeature_userposts'); $prevurl = new moodle_url('/mod/forumng/feature/userposts/list.php', $forum->get_link_params_array()); $pageurl = new moodle_url('/mod/forumng/feature/userposts/user.php', $pageparams); $out = $forum->init_page($pageurl, $pagename, array($prevpage => $prevurl)); print $out->header(); foreach ($posts as $postid => $post) { print "<div class='forumng-userpostheading'>"; // Get URL to post. print '<a href="' . s($post->get_url()) . '">'; // If this post is a reply, then print a link to the discussion. if (!$post->is_root_post()) { print get_string('replyin', 'forumngfeature_userposts', $post->get_discussion()->get_subject()); } else { print get_string('newdiscussion', 'forumng'); } print "</a></div>"; // Display this post. $options = array(mod_forumng_post::OPTION_NO_COMMANDS => true, mod_forumng_post::OPTION_FIRST_UNREAD => false, mod_forumng_post::OPTION_UNREAD_NOT_HIGHLIGHTED => true); print $post->display(true, $options); } if ($forum->can_grade()) { forumngfeature_userposts_display_user_grade($cm->id, $forum, $user, $groupid); } // Display link to the discussion. print link_arrow_left($prevpage, 'list.php?id=' . $cmid); // Display footer. print $out->footer(); add_to_log($course->id, 'forumng', 'view', 'user.php?' . $pageurl->get_query_string(false));
print_footer($course); return; } $table = new stdClass(); $table->head = array(get_string('time'), get_string('user')); if ($CFG->forumng_showusername) { $table->head[] = get_string('username'); } if ($CFG->forumng_showidnumber) { $table->head[] = get_string('idnumber'); } $table->data = array(); foreach ($readers as $reader) { $row = array(); $row[] = userdate($reader->time); $row[] = $forum->display_user_link($reader->user); if ($CFG->forumng_showusername) { $row[] = htmlspecialchars($reader->user->username); } if ($CFG->forumng_showidnumber) { $row[] = htmlspecialchars($reader->user->idnumber); } $table->data[] = $row; } print_table($table); print link_arrow_left($discussion->get_subject(), '../../discuss.php?' . $discussion->get_link_params(forum::PARAM_HTML)); // Display footer print_footer($course); } catch (forum_exception $e) { forum_utils::handle_exception($e); }