本文整理汇总了PHP中get_accesshide函数的典型用法代码示例。如果您正苦于以下问题:PHP get_accesshide函数的具体用法?PHP get_accesshide怎么用?PHP get_accesshide使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_accesshide函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: section_left_content
/**
* Generate the content to displayed on the left part of a section
* before course modules are included
*
* @param stdClass $section The course_section entry from DB
* @param stdClass $course The course entry from DB
* @param bool $onsectionpage true if being printed on a section page
* @return string HTML to output.
*/
protected function section_left_content($section, $course, $onsectionpage)
{
$o = $this->output->spacer();
if ($section->section != 0) {
// Only in the non-general sections.
if (course_get_format($course)->is_section_current($section)) {
$o .= get_accesshide(get_string('currentsection', 'format_' . $course->format));
}
}
return $o;
}
示例2: print_header
function print_header($title)
{
global $USER, $CFG;
$replacements = array('%fullname%' => get_string('mymoodle', 'my'));
foreach ($replacements as $search => $replace) {
$title = str_replace($search, $replace, $title);
}
$site = get_site();
$button = update_mymoodle_icon($USER->id);
$nav = get_string('mymoodle', 'my');
$header = $site->shortname . ': ' . $nav;
$navlinks = array(array('name' => $nav, 'link' => '', 'type' => 'misc'));
$navigation = build_navigation($navlinks);
$loggedinas = user_login_string($site);
if (empty($CFG->langmenu)) {
$langmenu = '';
} else {
$currlang = current_language();
$langs = get_list_of_languages();
$langlabel = get_accesshide(get_string('language'));
$langmenu = popup_form($CFG->wwwroot . '/my/index.php?lang=', $langs, 'chooselang', $currlang, '', '', '', true, 'self', $langlabel);
}
print_header($title, $header, $navigation, '', '', true, $button, $loggedinas . $langmenu);
}
示例3: get_section_name
if ($showsection) {
$sectionmenu[$section] = get_section_name($course, $thissection);
}
$section++;
continue;
}
if ($showsection) {
//what is course marker?
$currenttopic = $course->marker == $section;
$currenttext = '';
if (!$thissection->visible) {
$sectionstyle = ' hidden';
} else {
if ($currenttopic) {
$sectionstyle = ' current';
$currenttext = get_accesshide(get_string('currenttopic', 'format_bootstraptabs'));
} else {
$sectionstyle = '';
}
}
//the default action is to set the name of each topic to null.
$secname = $thissection->name;
//this will set the name of undefined sections to a number.
if ($secname == null) {
$secname = $secname . $num;
$num++;
}
if (has_capability('moodle/course:viewhiddensections', $context) || $thissection->visible) {
if ($section == 1) {
echo '<div role="tabpanel" class="tab-pane fade in active" id="section-' . $section . '">';
} else {
示例4: array
if (count($data) > 1) {
// Chart only works if more than 1 record.
$PAGE->requires->yui_module('moodle-forumngfeature_usage-usagegraph', 'M.mod_forumng.forumngfeature_usage_chart.output', array($data, $axes, $options));
}
$usageoutput .= html_writer::start_div('forumng_usage_usagechart');
$help = $OUTPUT->help_icon('usagechartpoststot', 'forumngfeature_usage');
$usageoutput .= $OUTPUT->heading(get_string('usagechartpoststotal', 'forumngfeature_usage', $postcount) . $help, 4);
$usageoutput .= $dateform->render();
// Accessible table of chart.
$charttable = new html_table();
$charttable->head = array($datelabel, $postslabel, $totallabel);
$charttable->data = $data;
$charttable->summary = get_string('usagechartpoststable', 'forumngfeature_usage');
if (count($data) > 1) {
// Show table hidden for screenreaders (also keyboard focus toggled by css).
$usageoutput .= get_accesshide(html_writer::table($charttable), 'div', 'skip', 'tabindex = 0');
$usageoutput .= html_writer::div('', 'forumng_usage_chart', array('id' => 'usagechart'));
} else {
// Show table instead of chart.
$usageoutput .= html_writer::table($charttable);
}
$usageoutput .= html_writer::end_div();
}
if ($forum->can_view_subscribers()) {
// View subscriber info.
$subs = $forum->get_subscribers($groupid);
$discussioncount = 0;
$groupcount = 0;
$wholecount = 0;
foreach ($subs as $subscriber) {
if (!empty($subscriber->wholeforum)) {
示例5: link_arrow_left
/**
* Return the left arrow with text ('previous'), and optionally embedded in a link.
*
* @global object
* @param string $text HTML/plain text label (set to blank only for breadcrumb separator cases).
* @param string $url An optional link to use in a surrounding HTML anchor.
* @param bool $accesshide True if text should be hidden (for screen readers only).
* @param string $addclass Additional class names for the link, or the arrow character.
* @return string HTML string.
*/
function link_arrow_left($text, $url = '', $accesshide = false, $addclass = '')
{
global $OUTPUT;
// TODO: move to utput renderer
$arrowclass = 'arrow ';
if (!$url) {
$arrowclass .= $addclass;
}
$arrow = '<span class="' . $arrowclass . '">' . $OUTPUT->larrow() . '</span>';
$htmltext = '';
if ($text) {
$htmltext = ' <span class="arrow_text">' . $text . '</span>';
if ($accesshide) {
$htmltext = get_accesshide($htmltext);
}
}
if ($url) {
$class = 'arrow_link';
if ($addclass) {
$class .= ' ' . $addclass;
}
return '<a class="' . $class . '" href="' . $url . '" title="' . preg_replace('/<.*?>/', '', $text) . '">' . $arrow . $htmltext . '</a>';
}
return $arrow . $htmltext;
}
示例6: calendar_get_mini
//.........这里部分代码省略.........
} else {
if ($event->groupid) {
// Group event
$popupicon = $CFG->pixpath . '/c/group.gif';
$popupalt = '';
} else {
if ($event->userid) {
// User event
$popupicon = $CFG->pixpath . '/c/user.gif';
$popupalt = '';
}
}
}
}
}
$popupcontent .= '<div><img class="icon" src="' . $popupicon . '" alt="' . $popupalt . '" /><a href="' . $dayhref . '#event_' . $event->id . '">' . format_string($event->name, true) . '</a></div>';
}
//Accessibility: functionality moved to calendar_get_popup.
if ($display->thismonth && $day == $d) {
$popup = calendar_get_popup(true, $events[$eventid]->timestart, $popupcontent);
} else {
$popup = calendar_get_popup(false, $events[$eventid]->timestart, $popupcontent);
}
// Class and cell content
if (isset($typesbyday[$day]['startglobal'])) {
$class .= ' event_global';
} else {
if (isset($typesbyday[$day]['startcourse'])) {
$class .= ' event_course';
} else {
if (isset($typesbyday[$day]['startgroup'])) {
$class .= ' event_group';
} else {
if (isset($typesbyday[$day]['startuser'])) {
$class .= ' event_user';
}
}
}
}
$cell = '<a href="' . $dayhref . '" ' . $popup . '>' . $day . '</a>';
} else {
$cell = $day;
}
if (isset($typesbyday[$day]['durationglobal'])) {
$class .= ' duration_global';
} else {
if (isset($typesbyday[$day]['durationcourse'])) {
$class .= ' duration_course';
} else {
if (isset($typesbyday[$day]['durationgroup'])) {
$class .= ' duration_group';
} else {
if (isset($typesbyday[$day]['durationuser'])) {
$class .= ' duration_user';
}
}
}
}
// If event has a class set then add it to the table day <td> tag
// Note: only one colour for minicalendar
if (isset($eventsbyday[$day])) {
foreach ($eventsbyday[$day] as $eventid) {
if (!isset($events[$eventid])) {
continue;
}
$event = $events[$eventid];
if (!empty($event->class)) {
$class .= ' ' . $event->class;
}
break;
}
}
// Special visual fx for today
//Accessibility: hidden text for today, and popup.
if ($display->thismonth && $day == $d) {
$class .= ' today';
$today = get_string('today', 'calendar') . ' ' . userdate(time(), get_string('strftimedayshort'));
if (!isset($eventsbyday[$day])) {
$class .= ' eventnone';
$popup = calendar_get_popup(true, false);
$cell = '<a href="#" ' . $popup . '>' . $day . '</a>';
}
$cell = get_accesshide($today . ' ') . $cell;
}
// Just display it
if (!empty($class)) {
$class = ' class="' . $class . '"';
}
$content .= '<td' . $class . '>' . $cell . "</td>\n";
}
// Paddding (the last week may have blank days at the end)
for ($i = $dayweek; $i <= $display->maxwday; ++$i) {
$content .= '<td class="dayblank"> </td>';
}
$content .= '</tr>';
// Last row ends
$content .= '</table>';
// Tabular display of days ends
return $content;
}
示例7: print_headers
/**
* This function is not part of the public api.
*/
function print_headers()
{
global $CFG, $OUTPUT;
echo '<tr>';
foreach ($this->columns as $column => $index) {
$icon_hide = '';
$icon_sort = '';
if ($this->is_collapsible) {
if (!empty($this->sess->collapse[$column])) {
// some headers contain < br/> tags, do not include in title
$icon_hide = ' <a href="' . $this->baseurl . $this->request[ILP_TABLE_VAR_SHOW] . '=' . $column . '"><img src="' . $OUTPUT->pix_url('t/switch_plus') . '" title="' . get_string('show') . ' ' . strip_tags($this->headers[$index]) . '" alt="' . get_string('show') . '" /></a>';
} else {
if ($this->headers[$index] !== NULL) {
// some headers contain < br/> tags, do not include in title
$icon_hide = ' <a href="' . $this->baseurl . $this->request[ILP_TABLE_VAR_HIDE] . '=' . $column . '"><img src="' . $OUTPUT->pix_url('t/switch_minus') . '" title="' . get_string('hide') . ' ' . strip_tags($this->headers[$index]) . '" alt="' . get_string('hide') . '" /></a>';
}
}
}
$primary_sort_column = '';
$primary_sort_order = '';
if (reset($this->sess->sortby)) {
$primary_sort_column = key($this->sess->sortby);
$primary_sort_order = current($this->sess->sortby);
}
switch ($column) {
case 'fullname':
if ($this->is_sortable($column)) {
$icon_sort_first = $icon_sort_last = '';
if ($primary_sort_column == 'firstname') {
$lsortorder = get_string('asc');
if ($primary_sort_order == SORT_ASC) {
$icon_sort_first = ' <img src="' . $OUTPUT->pix_url('t/down') . '" alt="' . get_string('asc') . '" />';
$fsortorder = get_string('asc');
} else {
$icon_sort_first = ' <img src="' . $OUTPUT->pix_url('t/up') . '" alt="' . get_string('desc') . '" />';
$fsortorder = get_string('desc');
}
} else {
if ($primary_sort_column == 'lastname') {
$fsortorder = get_string('asc');
if ($primary_sort_order == SORT_ASC) {
$icon_sort_last = ' <img src="' . $OUTPUT->pix_url('t/down') . '" alt="' . get_string('asc') . '" />';
$lsortorder = get_string('asc');
} else {
$icon_sort_last = ' <img src="' . $OUTPUT->pix_url('t/up') . '" alt="' . get_string('desc') . '" />';
$lsortorder = get_string('desc');
}
} else {
$fsortorder = get_string('asc');
$lsortorder = get_string('asc');
}
}
$override = new object();
$override->firstname = 'firstname';
$override->lastname = 'lastname';
$fullnamelanguage = get_string('fullnamedisplay', '', $override);
if ($CFG->fullnamedisplay == 'firstname lastname' or $CFG->fullnamedisplay == 'firstname' or $CFG->fullnamedisplay == 'language' and $fullnamelanguage == 'firstname lastname') {
$this->headers[$index] = '<a href="' . $this->baseurl . $this->request[ILP_TABLE_VAR_SORT] . '=firstname">' . get_string('firstname') . get_accesshide(get_string('sortby') . ' ' . get_string('firstname') . ' ' . $fsortorder) . '</a> ' . $icon_sort_first . ' / ' . '<a href="' . $this->baseurl . $this->request[ILP_TABLE_VAR_SORT] . '=lastname">' . get_string('lastname') . get_accesshide(get_string('sortby') . ' ' . get_string('lastname') . ' ' . $lsortorder) . '</a> ' . $icon_sort_last;
} else {
$this->headers[$index] = '<a href="' . $this->baseurl . $this->request[ILP_TABLE_VAR_SORT] . '=lastname">' . get_string('lastname') . get_accesshide(get_string('sortby') . ' ' . get_string('lastname') . ' ' . $lsortorder) . '</a> ' . $icon_sort_last . ' / ' . '<a href="' . $this->baseurl . $this->request[ILP_TABLE_VAR_SORT] . '=firstname">' . get_string('firstname') . get_accesshide(get_string('sortby') . ' ' . get_string('firstname') . ' ' . $fsortorder) . '</a> ' . $icon_sort_first;
}
}
break;
case 'userpic':
// do nothing, do not display sortable links
break;
default:
if ($this->is_sortable($column)) {
if ($primary_sort_column == $column) {
if ($primary_sort_order == SORT_ASC) {
$icon_sort = ' <img src="' . $OUTPUT->pix_url('t/down') . '" alt="' . get_string('asc') . '" />';
$localsortorder = get_string('asc');
} else {
$icon_sort = ' <img src="' . $OUTPUT->pix_url('t/up') . '" alt="' . get_string('desc') . '" />';
$localsortorder = get_string('desc');
}
} else {
$localsortorder = get_string('asc');
}
$this->headers[$index] = '<a href="' . $this->baseurl . $this->request[ILP_TABLE_VAR_SORT] . '=' . $column . '">' . $this->headers[$index] . get_accesshide(get_string('sortby') . ' ' . $this->headers[$index] . ' ' . $localsortorder) . '</a>';
}
}
if ($this->headers[$index] === NULL) {
echo '<th class="header c' . $index . $this->column_class[$column] . '" scope="col"> </th>';
} else {
if (!empty($this->sess->collapse[$column])) {
echo '<th class="header c' . $index . $this->column_class[$column] . '" scope="col">' . $icon_hide . '</th>';
} else {
// took out nowrap for accessibility, might need replacement
if (!is_array($this->column_style[$column])) {
// $usestyles = array('white-space:nowrap');
$usestyles = '';
} else {
// $usestyles = $this->column_style[$column]+array('white-space'=>'nowrap');
$usestyles = $this->column_style[$column];
}
echo '<th class="header c' . $index . $this->column_class[$column] . '" ' . $this->make_styles_string($usestyles) . ' scope="col">' . $this->headers[$index] . $icon_sort . '<div class="commands">' . $icon_hide . '</div></th>';
//.........这里部分代码省略.........
示例8: ss_print_section
//.........这里部分代码省略.........
$instancename = format_string($modinfo->cms[$modnumber]->name, true, $course->id);
# echo format_string($modinfo->cms[$modnumber]->intro, true, $course->id);
# echo format_string($modinfo->cms[$modnumber]->name, true, $course->id);
# print_r($modinfo->cms[$modnumber]);
$customicon = $modinfo->cms[$modnumber]->icon;
if (!empty($customicon)) {
if (substr($customicon, 0, 4) === 'mod/') {
list($modname, $iconname) = explode('/', substr($customicon, 4), 2);
$icon = $OUTPUT->pix_url($iconname, $modname);
} else {
$icon = $OUTPUT->pix_url($customicon);
}
} else {
$icon = $OUTPUT->pix_url('icon', $mod->modname);
}
//Accessibility: for files get description via icon, this is very ugly hack!
$altname = '';
$altname = $mod->modfullname;
if (!empty($customicon)) {
$archetype = plugin_supports('mod', $mod->modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
if ($archetype == MOD_ARCHETYPE_RESOURCE) {
$mimetype = mimeinfo_from_icon('type', $customicon);
$altname = get_mimetype_description($mimetype);
}
}
// Avoid unnecessary duplication.
if (false !== stripos($instancename, $altname)) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
if ($altname) {
$altname = get_accesshide(' '.$altname);
}
// We may be displaying this just in order to show information
// about visibility, without the actual link
if ($mod->uservisible) {
// Display normal module link
if (!$accessiblebutdim) {
$linkcss = '';
$accesstext ='';
} else {
$linkcss = ' class="dimmed" ';
$accesstext = '<span class="accesshide">'.
get_string('hiddenfromstudents').': </span>';
}
echo '<a '.$linkcss.' '.$extra.
' href="'.$CFG->wwwroot.'/mod/'.$mod->modname.'/view.php?id='.$mod->id.'">'.
'<img src="'.$icon.'" class="activityicon" alt="'.get_string('modulename',$mod->modname).'" /> '.
$accesstext.'<span class="instancename">'.$instancename.$altname.'</span></a>';
if (!empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
$groupings = groups_get_all_groupings($course->id);
}
echo " <span class=\"groupinglabel\">(".format_string($groupings[$mod->groupingid]->name).')</span>';
}
} else {
// Display greyed-out text of link
echo '<span class="dimmed_text" '.$extra.' ><span class="accesshide">'.
get_string('notavailableyet','condition').': </span>'.
'<img src="'.$icon.'" class="activityicon" alt="'.get_string('modulename', $mod->modname).'" /> <span>'.
$instancename.$altname.'</span></span>';
示例9: sort_link
/**
* Generate the HTML for the sort link. This is a helper method used by {@link print_headers()}.
* @param string $text the text for the link.
* @param string $column the column name, may be a fake column like 'firstname' or a real one.
* @param bool $isprimary whether the is column is the current primary sort column.
* @param int $order SORT_ASC or SORT_DESC
* @return string HTML fragment.
*/
protected function sort_link($text, $column, $isprimary, $order)
{
return html_writer::link($this->baseurl->out(false, array($this->request[TABLE_VAR_SORT] => $column)), $text . get_accesshide(get_string('sortby') . ' ' . $text . ' ' . $this->sort_order_name($isprimary, $order))) . ' ' . $this->sort_icon($isprimary, $order);
}
示例10: course_section_cm_text
/**
* Renders html to display the module content on the course page (i.e. text of the labels)
*
* @param cm_info $mod
* @param array $displayoptions
* @return string
*/
public function course_section_cm_text(cm_info $mod, $displayoptions = array())
{
$output = '';
if (!$mod->uservisible && (empty($mod->showavailability) || empty($mod->availableinfo))) {
// nothing to be displayed to the user
return $output;
}
$content = $mod->get_formatted_content(array('overflowdiv' => true, 'noclean' => true));
$conditionalhidden = $this->is_cm_conditionally_hidden($mod);
$accessiblebutdim = !$mod->visible || $conditionalhidden;
$textclasses = '';
$accesstext = '';
if ($accessiblebutdim) {
$textclasses .= ' dimmed_text';
if ($conditionalhidden) {
$textclasses .= ' conditionalhidden';
}
if ($mod->uservisible) {
// show accessibility note only if user can access the module himself
$accesstext = get_accesshide(get_string('hiddenfromstudents') . ': ');
}
}
if ($mod->get_url()) {
if ($content) {
// If specified, display extra content after link.
$output = html_writer::tag('div', $content, array('class' => trim('contentafterlink ' . $textclasses)));
}
} else {
// No link, so display only content.
$output = html_writer::tag('div', $accesstext . $content, array('class' => $textclasses));
}
return $output;
}
示例11: print_section_newsroom
//.........这里部分代码省略.........
if (!empty($CFG->enablegroupings) && !empty($mod->groupingid) && has_capability('moodle/course:managegroups', get_context_instance(CONTEXT_COURSE, $course->id))) {
if (!isset($groupings)) {
$groupings = groups_get_all_groupings($course->id);
}
echo " <span class=\"groupinglabel\">(" . format_string($groupings[$mod->groupingid]->name) . ')</span>';
}
} else {
// Normal activity
$instancename = format_string($modinfo->cms[$modnumber]->name, true, $course->id);
if (!empty($modinfo->cms[$modnumber]->icon)) {
$icon = "{$CFG->pixpath}/" . $modinfo->cms[$modnumber]->icon;
} else {
$icon = "{$CFG->modpixpath}/{$mod->modname}/icon.gif";
}
//Accessibility: for files get description via icon.
$altname = '';
if ('resource' == $mod->modname) {
if (!empty($modinfo->cms[$modnumber]->icon)) {
$possaltname = $modinfo->cms[$modnumber]->icon;
$mimetype = mimeinfo_from_icon('type', $possaltname);
$altname = get_mimetype_description($mimetype);
} else {
$altname = $mod->modfullname;
}
} else {
$altname = $mod->modfullname;
}
// Avoid unnecessary duplication.
if (false !== stripos($instancename, $altname)) {
$altname = '';
}
// File type after name, for alphabetic lists (screen reader).
if ($altname) {
$altname = get_accesshide(' ' . $altname);
}
$linkcss = $mod->visible ? "" : " class=\"dimmed\" ";
echo '<a ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . '<img src="' . $icon . '" class="activityicon" alt="" /> <span>' . $instancename . $altname . '</span></a>';
//echo " $mod->modname ";
// Special NEWSPAPER magic ... show summry from resource and blog's 200 chars from each post OUBlog (nadavkav)
if ($mod->modname == 'resource') {
$article = get_record('resource', 'id', $mod->instance);
//print_r($article );
echo "{$article->summary}";
}
if ($mod->modname == 'oublog') {
require_once $CFG->dirroot . '/mod/oublog/locallib.php';
$oublog = get_record('oublog', 'id', $mod->instance);
if (!($oublogcm = get_coursemodule_from_instance('oublog', $oublog->id))) {
//error("Course module ID was incorrect");
}
$oublogcontext = get_context_instance(CONTEXT_MODULE, $oublogcm->id);
//oublog_check_view_permissions($oublog, $oublogcontext, $oublogcm);
$currentgroup = oublog_get_activity_group($oublogcm, true);
echo '<br/>';
/// Get Posts
list($posts, $recordcount) = oublog_get_posts($oublog, $oublogcontext, 0, $oublogcm, $currentgroup);
//, -1, $oubloguser->id, $tag, $canaudit);
$i = 0;
foreach ($posts as $post) {
if ($i < 3) {
echo '<a href="' . $CFG->wwwroot . '/mod/oublog/viewpost.php?blog=' . $oublog->id . '&post=' . $post->id . '">' . $post->title . '</a><br/>';
$summaryformatoptions->noclean = false;
echo mb_substr(format_text($post->message, FORMAT_HTML, $summaryformatoptions), 1, 600) . "<hr/>";
}
if ($i > 2 and $i < 6) {
echo '<a href="' . $CFG->wwwroot . '/mod/oublog/viewpost.php?blog=' . $oublog->id . '&post=' . $post->id . '">' . $post->title . '</a><br/>';
示例12: print_multiple_section_page
//.........这里部分代码省略.........
// 0-section is displayed a little different then the others.
if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
echo $this->section_header($thissection, $course, false, 0);
$courserenderer = $PAGE->get_renderer('core', 'course');
echo $courserenderer->course_section_cm_list($course, $thissection, 0);
if ($PAGE->user_is_editing()) {
echo $courserenderer->course_section_add_cm_control($course, 0, 0);
}
echo $this->section_footer();
}
continue;
}
if ($section > $course->numsections) {
// Activities inside this section are 'orphaned', this section will be printed as 'stealth' below.
continue;
}
// Show the section if the user is permitted to access it, OR if it's not available.
// but showavailability is turned on (and there is some available info text).
$proximity = new stdClass();
if ($thissection->format_gps_restricted == FORMAT_GPS_RESTRICTED) {
if ($location) {
$proximity = format_gps_check_proximity($thissection, $location);
} else {
$proximity->status = 'notallowed';
}
} else {
$proximity->status = 'ok';
}
$showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && $thissection->showavailability && !empty($thissection->availableinfo);
if (!$showsection || $proximity->status == 'toofar' || $proximity->status == 'notallowed') {
if ($PAGE->user_is_editing() && has_capability('moodle/course:update', $context)) {
// Do nothing.
} else {
$thissection->visible = false;
// Hidden section message is overridden by 'unavailable' control
// (showavailability option).
if ($proximity->status == 'toofar') {
if (!$course->hiddensections && $thissection->available) {
echo $this->gps_section_hidden($section);
}
} else {
if ($proximity->status == 'notallowed') {
if (!$course->hiddensections && $thissection->available) {
echo $this->gps_section_notallowed($section);
}
} else {
if (!$course->hiddensections && $thissection->available) {
echo $this->section_hidden($section);
}
}
}
continue;
}
}
if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
// Display section summary only.
echo $this->section_summary($thissection, $course, null);
} else {
echo $this->section_header($thissection, $course, false, 0);
if ($thissection->uservisible) {
$courserenderer = $PAGE->get_renderer('core', 'course');
echo $courserenderer->course_section_cm_list($course, $thissection, 0);
if ($PAGE->user_is_editing()) {
echo $courserenderer->course_section_add_cm_control($course, $section, 0);
}
}
echo $this->section_footer();
}
}
if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
// Print stealth sections if present.
foreach ($modinfo->get_section_info_all() as $section => $thissection) {
if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
// This is not stealth section or it is empty.
continue;
}
echo $this->stealth_section_header($section);
$courserenderer = $PAGE->get_renderer('core', 'course');
echo $courserenderer->course_section_cm_list($course, $thissection, 0);
echo $this->stealth_section_footer();
}
echo $this->end_section_list();
echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
// Increase number of sections.
$straddsection = get_string('increasesections', 'moodle');
$url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
$icon = $this->output->pix_icon('t/switch_plus', $straddsection);
echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
if ($course->numsections > 0) {
// Reduce number of sections sections.
$strremovesection = get_string('reducesections', 'moodle');
$url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
$icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
}
echo html_writer::end_tag('div');
} else {
echo $this->end_section_list();
}
}
示例13: print_multiple_section_page
//.........这里部分代码省略.........
$last = false;
if ($section > $course->numsections) {
// Activities inside this section are 'orphaned', this section will be printed as 'stealth' below.
continue;
}
if ($section == $course->numsections) {
$last = true;
}
if ($section == 1) {
$first = true;
}
/* Show the section if the user is permitted to access it, OR if it's not available
but there is some available info text which explains the reason & should display. */
$showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo);
if (!$showsection) {
continue;
}
$tabattributes = array('role' => 'presentation', 'id' => 'navtab' . $section, 'class' => 'tabbednavtab');
if (!$this->activesection) {
$this->activesection = $thissection->section;
$tabattributes['class'] = 'tabbednavtab active';
}
echo html_writer::start_tag('li', $tabattributes);
if (!$first) {
echo html_writer::tag('div', '', array('class' => 'nav-wedge'));
}
echo html_writer::tag('a', $this->courseformat->get_section_name($thissection), array('href' => '#section-' . $thissection->section, 'data-toggle' => 'tab', 'role' => 'tab', 'aria-controls' => 'section-' . $thissection->section));
if (!$last) {
echo html_writer::tag('div', '', array('class' => 'nav-arrow'));
}
echo html_writer::end_tag('li');
}
echo html_writer::end_tag('ul');
echo html_writer::start_tag('div', array('id' => 'tabbedcontent', 'class' => 'tab-content'));
}
// Tabbed.
foreach ($sections as $section => $thissection) {
if ($section > $course->numsections) {
// Activities inside this section are 'orphaned', this section will be printed as 'stealth' below.
continue;
}
/* Show the section if the user is permitted to access it, OR if it's not available
but there is some available info text which explains the reason & should display. */
$showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo);
if (!$showsection) {
/* If the hiddensections option is set to 'show hidden sections in collapsed
form', then display the hidden section message - UNLESS the section is
hidden by the availability system, which is set to hide the reason. */
if (!$course->hiddensections && $thissection->available) {
echo $this->section_hidden($section, $course->id);
}
continue;
}
echo $this->section_header($thissection, $course, false, 0);
if ($thissection->uservisible) {
echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
echo $this->courserenderer->course_section_add_cm_control($course, $section, 0);
$sectionnavlinks = $this->get_nav_links($course, $modinfo->get_section_info_all(), $section);
$navlinks = html_writer::start_tag('div', array('class' => 'section-navigation navigationtitle'));
$navlinks .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'pull-left'));
$navlinks .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'pull-right'));
$navlinks .= html_writer::end_tag('div');
echo $navlinks;
}
echo $this->section_footer();
}
if ($this->userisediting and has_capability('moodle/course:update', $context)) {
// Print stealth sections if present.
foreach ($modinfo->get_section_info_all() as $section => $thissection) {
if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
// This is not stealth section or it is empty.
continue;
}
echo $this->stealth_section_header($section);
echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
echo $this->stealth_section_footer();
}
echo $this->end_section_list();
echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
// Increase number of sections.
$straddsection = get_string('increasesections', 'moodle');
$url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
$icon = $this->output->pix_icon('t/switch_plus', $straddsection);
echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
if ($course->numsections > 0) {
// Reduce number of sections sections.
$strremovesection = get_string('reducesections', 'moodle');
$url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
$icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
}
echo html_writer::end_tag('div');
} else {
if ($this->userisediting) {
echo $this->end_section_list();
} else {
echo html_writer::end_tag('div');
}
}
}
示例14: print_multiple_section_page
//.........这里部分代码省略.........
if (course_get_format($course)->is_section_current($section)) {
$style = "active";
$currentfound = true;
}
if ($section == 0) {
$section0html = $a;
} else {
$tabshtml .= html_writer::tag("li", $a, array("role" => "presentation", "class" => $style));
}
}
$style = $currentfound ? "" : "active";
echo html_writer::tag("li", $section0html, array("role" => "presentation", "class" => $style)) . $tabshtml;
echo html_writer::end_tag("ul");
// Now the list of sections..
echo $this->start_section_list();
$cmlist = "";
$firstsection = "";
$firstsectionhead = "";
$firstsectionheadactive = "";
$currentfound = false;
foreach ($modinfo->get_section_info_all() as $section => $thissection) {
if (course_get_format($course)->is_section_current($section)) {
$currentfound = true;
}
if ($section == 0) {
// 0-section is displayed a little different then the others
if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
$firstsectionhead = $this->section_header($thissection, $course, false, 0, false);
$firstsectionheadactive = $this->section_header($thissection, $course, false, 0, true);
$firstsection .= $this->courserenderer->course_section_cm_list($course, $thissection, 0);
$firstsection .= $this->courserenderer->course_section_add_cm_control($course, 0, 0);
$firstsection .= $this->section_footer();
}
continue;
}
if ($section > $course->numsections) {
// activities inside this section are 'orphaned', this section will be printed as 'stealth' below
continue;
}
// Show the section if the user is permitted to access it, OR if it's not available
// but there is some available info text which explains the reason & should display.
$showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && !empty($thissection->availableinfo);
if (!$showsection) {
// If the hiddensections option is set to 'show hidden sections in collapsed
// form', then display the hidden section message - UNLESS the section is
// hidden by the availability system, which is set to hide the reason.
if (!$course->hiddensections && $thissection->available) {
$cmlist .= $this->section_hidden($section, $course->id);
}
continue;
}
if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
// Display section summary only.
$cmlist .= $this->section_summary($thissection, $course, null);
} else {
$cmlist .= $this->section_header($thissection, $course, false, 0);
if ($thissection->uservisible) {
$cmlist .= $this->courserenderer->course_section_cm_list($course, $thissection, 0);
$cmlist .= $this->courserenderer->course_section_add_cm_control($course, $section, 0);
}
$cmlist .= $this->section_footer();
}
}
if (!$currentfound) {
$firstsection = $firstsectionheadactive . $firstsection;
} else {
$firstsection = $firstsectionhead . $firstsection;
}
echo $firstsection . $cmlist;
if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
// Print stealth sections if present.
foreach ($modinfo->get_section_info_all() as $section => $thissection) {
if ($section <= $course->numsections or empty($modinfo->sections[$section])) {
// this is not stealth section or it is empty
continue;
}
echo $this->stealth_section_header($section);
echo $this->courserenderer->course_section_cm_list($course, $thissection, 0);
echo $this->stealth_section_footer();
}
echo $this->end_section_list();
echo html_writer::end_div();
echo html_writer::start_tag('div', array('id' => 'changenumsections', 'class' => 'mdl-right'));
// Increase number of sections.
$straddsection = get_string('increasesections', 'moodle');
$url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => true, 'sesskey' => sesskey()));
$icon = $this->output->pix_icon('t/switch_plus', $straddsection);
echo html_writer::link($url, $icon . get_accesshide($straddsection), array('class' => 'increase-sections'));
if ($course->numsections > 0) {
// Reduce number of sections sections.
$strremovesection = get_string('reducesections', 'moodle');
$url = new moodle_url('/course/changenumsections.php', array('courseid' => $course->id, 'increase' => false, 'sesskey' => sesskey()));
$icon = $this->output->pix_icon('t/switch_minus', $strremovesection);
echo html_writer::link($url, $icon . get_accesshide($strremovesection), array('class' => 'reduce-sections'));
}
echo html_writer::end_tag('div');
} else {
echo $this->end_section_list();
}
}
示例15: render_mr_html_table
/**
* Render mr_html_table
*
* @param mr_html_table $table mr_html_table instance
* @return string
*/
protected function render_mr_html_table(mr_html_table $table)
{
$tag = new mr_html_tag();
$rows = $table->get_rows();
$columns = $table->get_columns(true);
// Table setup
$htmltable = new html_table();
$htmltable->data = array();
foreach ($table->get_attributes() as $name => $value) {
if (property_exists($htmltable, $name)) {
$htmltable->{$name} = $value;
} else {
$htmltable->attributes[$name] = $value;
}
}
// Check if we have any column headings
$haveheadings = false;
foreach ($columns as $column) {
if ($column->has_heading()) {
$haveheadings = true;
break;
}
}
if ($haveheadings) {
$htmltable->head = array();
foreach ($columns as $column) {
// Must set sortable to false if table is not sort enabled or if empty $rows
if (!$table->get_sortenabled() or empty($rows)) {
$column->set_config('sortable', false);
}
$config = $column->get_config();
// Figure out column sort controls
if ($config->sortable) {
$icon = '';
$sortstr = get_string('asc');
$sortord = SORT_ASC;
if ($table->get_sort() == $column->get_name()) {
if ($table->get_order() == SORT_ASC) {
$icon = $tag->img()->src($this->output->pix_url('t/down'))->alt(get_string('asc'));
$sortstr = get_string('asc');
$sortord = SORT_DESC;
} else {
$icon = $tag->img()->src($this->output->pix_url('t/up'))->alt(get_string('desc'));
}
}
$url = $table->get_url()->out(false, array('tsort' => $config->name, 'torder' => $sortord));
$heading = get_string('sortby') . ' ' . $config->heading . ' ' . $sortstr;
$heading = $config->heading . get_accesshide($heading);
$heading = $tag->a($heading)->href($url) . $icon;
} else {
$heading = $config->heading;
}
$cell = new html_table_cell($heading);
$cell->attributes = array_merge($cell->attributes, $config->attributes);
$htmltable->head[] = $cell;
}
}
if (empty($rows)) {
$cell = new html_table_cell($table->get_emptymessage());
$cell->colspan = count($htmltable->head);
$htmltable->data[] = new html_table_row(array($cell));
} else {
$htmltable->data = $this->convert_to_htmlrows($table);
}
return html_writer::tag('div', html_writer::table($htmltable), array('class' => 'mr_html_table'));
}