/** * Creates a next page arrow or the finishing link * * @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 */ public function review_next_navigation(quiz_attempt $attemptobj, $page, $lastpage) { if ($lastpage) { $nav = $this->finish_review_link($attemptobj); } else { $nav = link_arrow_right(get_string('next'), $attemptobj->review_url(null, $page + 1)); } return html_writer::tag('div', $nav, array('class' => 'submitbtns')); }
/** * Build and return a next 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_next($text, $linkbase, $d, $m, $y, $accesshide = false) { $href = calendar_get_link_href($linkbase, $d, $m, $y); if (empty($href)) { return $text; } return link_arrow_right($text, $href, $accesshide, 'next'); }
/** * Return the breadcrumb trail navigation separator. * * @return string HTML string. */ function get_separator() { //Accessibility: the 'hidden' slash is preferred for screen readers. return ' ' . link_arrow_right($text = '/', $url = '', $accesshide = true, 'sep') . ' '; }
/** * Build and return a next 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 Day * @param int $m The number of the month. * @param int $y 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_next($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_right($text, (string) $href, $accesshide, 'next'); }
/// Summary table end ============================================================================== /// Form for saving flags if necessary. if ($options->flags == QUESTION_FLAGSEDITABLE) { echo '<form action="' . s($attemptobj->review_url(0, $page, $showall)) . '" method="post" class="questionflagsaveform"><div>'; echo '<input type="hidden" name="sesskey" value="' . sesskey() . '" />'; } /// Print all the questions. if ($showall) { $thispage = 'all'; $lastpage = true; } else { $thispage = $page; $lastpage = $attemptobj->is_last_page($page); } foreach ($attemptobj->get_question_ids($thispage) as $id) { $attemptobj->print_question($id, true, $attemptobj->review_url($id, $page, $showall)); } /// Close form if we opened it. if ($options->flags == QUESTION_FLAGSEDITABLE) { echo '<div class="submitbtns">' . "\n" . '<input type="submit" class="questionflagsavebutton" name="savingflags" value="' . get_string('saveflags', 'question') . '" />' . "</div>\n" . "\n</div></form>\n"; $PAGE->requires->js_init_call('M.mod_quiz.init_review_form', null, false, quiz_get_js_module()); } /// Print a link to the next page. echo '<div class="submitbtns">'; if ($lastpage) { $accessmanager->print_finish_review_link($attemptobj->is_preview_user()); } else { echo link_arrow_right(get_string('next'), s($attemptobj->review_url(0, $page + 1))); } echo "</div>"; echo $OUTPUT->footer();
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 if (!$csv) { print '<br class="clearer"/>'; // ugh if (count($progress->users) == 0) { print '<p class="nousers">' . get_string('err_nousers', 'completion') . '</p>'; print '<p><a href="' . $reportsurl . '">' . get_string('continue') . '</a></p>'; echo $OUTPUT->footer(); exit;
/** * 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 (!empty($gpnode)) { $thirdfolder = html_writer::link(new moodle_url('/mod/wiziq/content.php', array('id' => $id, 'parentid' => $gpnode->id, 'sesskey' => sesskey())), $gpnode->name); $thirdlevel = link_arrow_right($thirdfolder); $pgpnode = $DB->get_record('wiziq_content', array('id' => $gpnode->parentid)); $folderpath = $pnode->name."/".$folderpath; } else { $thirdlevel = ""; } if (!empty($pgpnode)) { $lastfolder = html_writer::link(new moodle_url('/mod/wiziq/content.php', array('id' => $id, 'parentid' => $pgpnode->id, 'sesskey' => sesskey())), $pgpnode->name); $lastlevel = link_arrow_right($lastfolder); $folderpath = $gpnode->name."/".$folderpath; } else { $lastlevel = ""; } $bred = array(); $bred[] = $lastlevel; $bred[] = $thirdlevel; $bred[] = $secondlevel; $bred[] = $firstlevel; foreach ($bred as $bredcrum) { echo $bredcrum; } } else { $parent_not_fould = get_string('parent_not_fould', 'wiziq'); print_error($parent_not_fould, '', $PAGE->url);
/** * 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')); }
$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); $pageversion->id = $pageversion->userid; // To make it look like a user object $name = ouwiki_display_user($pageversion, $course->id); $savedby = get_string('savedby', 'ouwiki', $name); $stradvice = get_string('advice_viewold', 'ouwiki'); if (!empty($pageversion->deletedat)) { $stradvice = get_string('advice_viewdeleted', 'ouwiki'); } print "\n<div class='ouw_oldversion'>\n <h1>{$date} <span class='ouw_person'>({$savedby})</span></h1>\n <p>" . $stradvice . "</p>\n <div class='ouw_prev'>{$prev}</div>\n <div class='ouw_next'>{$next}</div>\n <div class='clearer'></div>\n</div>"; // Print page content
// 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);