本文整理汇总了PHP中print_section_add_menus函数的典型用法代码示例。如果您正苦于以下问题:PHP print_section_add_menus函数的具体用法?PHP print_section_add_menus怎么用?PHP print_section_add_menus使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_section_add_menus函数的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: get_content
//.........这里部分代码省略.........
return $this->content;
}
$course = $this->page->course;
require_once $CFG->dirroot . '/course/lib.php';
$context = context_course::instance($course->id);
$isediting = $this->page->user_is_editing() && has_capability('moodle/course:manageactivities', $context);
$modinfo = get_fast_modinfo($course);
/// extra fast view mode
if (!$isediting) {
if (!empty($modinfo->sections[0])) {
$options = array('overflowdiv' => true);
foreach ($modinfo->sections[0] as $cmid) {
$cm = $modinfo->cms[$cmid];
if (!$cm->uservisible) {
continue;
}
list($content, $instancename) = get_print_section_cm_text($cm, $course);
if (!($url = $cm->get_url())) {
$this->content->items[] = $content;
$this->content->icons[] = '';
} else {
$linkcss = $cm->visible ? '' : ' class="dimmed" ';
//Accessibility: incidental image - should be empty Alt text
$icon = '<img src="' . $cm->get_icon_url() . '" class="icon" alt="" /> ';
$this->content->items[] = '<a title="' . $cm->modplural . '" ' . $linkcss . ' ' . $cm->extra . ' href="' . $url . '">' . $icon . $instancename . '</a>';
}
}
}
return $this->content;
}
/// slow & hacky editing mode
$ismoving = ismoving($course->id);
$section = get_course_section(0, $course->id);
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
$groupbuttons = $course->groupmode;
$groupbuttonslink = !$course->groupmodeforce;
if ($ismoving) {
$strmovehere = get_string('movehere');
$strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'"));
$strcancel = get_string('cancel');
$stractivityclipboard = $USER->activitycopyname;
}
/// Casting $course->modinfo to string prevents one notice when the field is null
$editbuttons = '';
if ($ismoving) {
$this->content->icons[] = '<img src="' . $OUTPUT->pix_url('t/move') . '" class="iconsmall" alt="" />';
$this->content->items[] = $USER->activitycopyname . ' (<a href="' . $CFG->wwwroot . '/course/mod.php?cancelcopy=true&sesskey=' . sesskey() . '">' . $strcancel . '</a>)';
}
if (!empty($section->sequence)) {
$sectionmods = explode(',', $section->sequence);
$options = array('overflowdiv' => true);
foreach ($sectionmods as $modnumber) {
if (empty($mods[$modnumber])) {
continue;
}
$mod = $mods[$modnumber];
if (!$ismoving) {
if ($groupbuttons) {
if (!($mod->groupmodelink = $groupbuttonslink)) {
$mod->groupmode = $course->groupmode;
}
} else {
$mod->groupmode = false;
}
$editbuttons = '<div class="buttons">' . make_editing_buttons($mod, true, true) . '</div>';
} else {
$editbuttons = '';
}
if ($mod->visible || has_capability('moodle/course:viewhiddenactivities', $context)) {
if ($ismoving) {
if ($mod->id == $USER->activitycopy) {
continue;
}
$this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&sesskey=' . sesskey() . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $OUTPUT->pix_url('movehere') . '" alt="' . $strmovehere . '" /></a>';
$this->content->icons[] = '';
}
list($content, $instancename) = get_print_section_cm_text($modinfo->cms[$modnumber], $course);
$linkcss = $mod->visible ? '' : ' class="dimmed" ';
if (!($url = $mod->get_url())) {
$this->content->items[] = $content . $editbuttons;
$this->content->icons[] = '';
} else {
//Accessibility: incidental image - should be empty Alt text
$icon = '<img src="' . $mod->get_icon_url() . '" class="icon" alt="" /> ';
$this->content->items[] = '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $mod->extra . ' href="' . $url . '">' . $icon . $instancename . '</a>' . $editbuttons;
}
}
}
}
if ($ismoving) {
$this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?movetosection=' . $section->id . '&sesskey=' . sesskey() . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $OUTPUT->pix_url('movehere') . '" alt="' . $strmovehere . '" /></a>';
$this->content->icons[] = '';
}
if (!empty($modnames)) {
$this->content->footer = print_section_add_menus($course, 0, $modnames, true, true);
} else {
$this->content->footer = '';
}
return $this->content;
}
开发者ID:JP-Git,项目名称:moodle,代码行数:101,代码来源:block_site_main_menu.php
示例2: strip_tags
$stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname)));
echo '<p><font size="2">';
echo "{$stractivityclipboard} (<a href=\"course/mod.php?cancelcopy=true&sesskey={$USER->sesskey}\">" . get_string('cancel') . '</a>)';
echo '</font></p>';
}
$options = NULL;
$options->noclean = true;
echo format_text($section->summary, FORMAT_HTML, $options);
if ($editing) {
$streditsummary = get_string('editsummary');
echo "<a title=\"{$streditsummary}\" " . " href=\"course/editsection.php?id={$section->id}\"><img src=\"{$CFG->pixpath}/t/edit.gif\" " . " class=\"iconsmall\" alt=\"{$streditsummary}\" /></a><br /><br />";
}
get_all_mods($SITE->id, $mods, $modnames, $modnamesplural, $modnamesused);
print_section($SITE, $section, $mods, $modnamesused, true);
if ($editing) {
print_section_add_menus($SITE, $section->section, $modnames);
}
print_box_end();
}
}
if (isloggedin() and !isguest() and isset($CFG->frontpageloggedin)) {
$frontpagelayout = $CFG->frontpageloggedin;
} else {
$frontpagelayout = $CFG->frontpage;
}
foreach (explode(',', $frontpagelayout) as $v) {
switch ($v) {
/// Display the main part of the front page.
case FRONTPAGENEWS:
if ($SITE->newsitems) {
// Print forums only when needed
开发者ID:nagyistoce,项目名称:moodle-Teach-Pilot,代码行数:31,代码来源:index.php
示例3: render_subpage
//.........这里部分代码省略.........
if ($section->stealth) {
$content .= html_writer::start_tag('form', array('method' => 'post', 'action' => 'stealth.php'));
$content .= html_writer::start_tag('div');
$content .= html_writer::empty_tag('input', array('name' => 'id', 'value' => $subpage->get_course_module()->id, 'type' => 'hidden'));
$content .= html_writer::empty_tag('input', array('name' => 'sesskey', 'value' => sesskey(), 'type' => 'hidden'));
$content .= html_writer::empty_tag('input', array('name' => 'unstealth', 'value' => $section->id, 'type' => 'hidden'));
$content .= html_writer::empty_tag('input', array('name' => 'icon', 'src' => $OUTPUT->pix_url('unstealth', 'mod_subpage'), 'type' => 'image', 'title' => $strunstealth, 'alt' => $strunstealth));
$content .= html_writer::end_tag('div');
$content .= html_writer::end_tag('form');
} else {
$content .= html_writer::start_tag('form', array('method' => 'post', 'action' => 'stealth.php'));
$content .= html_writer::start_tag('div');
$content .= html_writer::empty_tag('input', array('name' => 'id', 'value' => $subpage->get_course_module()->id, 'type' => 'hidden'));
$content .= html_writer::empty_tag('input', array('name' => 'sesskey', 'value' => sesskey(), 'type' => 'hidden'));
$content .= html_writer::empty_tag('input', array('name' => 'stealth', 'value' => $section->id, 'type' => 'hidden'));
$content .= html_writer::empty_tag('input', array('name' => 'icon', 'src' => $OUTPUT->pix_url('stealth', 'mod_subpage'), 'type' => 'image', 'title' => $strstealth, 'alt' => $strstealth));
$content .= html_writer::end_tag('div');
$content .= html_writer::end_tag('form');
}
$content .= html_writer::empty_tag('br', array());
if ($movesection) {
$content .= html_writer::start_tag('span', array('class' => 'section_move_commands'));
if ($section->pageorder > 1) {
// Add a arrow to move section up
$content .= html_writer::start_tag('a', array('href' => 'view.php?id=' . $subpage->get_course_module()->id . '&random=' . rand(1, 10000) . '§ion=' . $section->id . '&move=-1&sesskey=' . sesskey() . '#section-' . ($section->id - 1), 'title' => $strmoveup));
$content .= html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/up'), 'class' => 'icon up', 'alt' => $strmoveup));
$content .= html_writer::end_tag('a');
$content .= html_writer::empty_tag('br', array());
}
if ($section->pageorder < $lastpageorder) {
// Add an arrow to move section down
$content .= html_writer::start_tag('a', array('href' => 'view.php?id=' . $subpage->get_course_module()->id . '&random=' . rand(1, 10000) . '§ion=' . $section->id . '&move=1&sesskey=' . sesskey() . '#section-' . ($section->id + 1), 'title' => $strmovedown));
$content .= html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/down'), 'class' => 'icon down', 'alt' => $strmovedown));
$content .= html_writer::end_tag('a');
$content .= html_writer::empty_tag('br', array());
}
$content .= html_writer::end_tag('span');
}
}
$content .= html_writer::end_tag('div');
$content .= html_writer::start_tag('div', array('class' => 'content'));
// Only show the section if visible and not stealthed or to users with permission
if (($section->visible && !$section->stealth || has_capability('moodle/course:viewhiddensections', $coursecontext)) && ($editing || !$section->autohide)) {
if ($section->stealth) {
$content .= html_writer::start_tag('div', array('class' => 'stealthed'));
}
if (!empty($section->name)) {
$content .= html_writer::tag('h3', format_string($section->name), array('class' => 'sectionname'));
}
$summary = '';
if ($section->summary) {
$summarytext = file_rewrite_pluginfile_urls($section->summary, 'pluginfile.php', $coursecontext->id, 'course', 'section', $section->id);
$summaryformatoptions = new stdClass();
$summaryformatoptions->noclean = true;
$summaryformatoptions->overflowdiv = true;
$summary .= format_text($summarytext, $section->summaryformat, $summaryformatoptions);
}
if ($editing && has_capability('moodle/course:update', $coursecontext)) {
$summary .= html_writer::start_tag('a', array('href' => $CFG->wwwroot . '/course/editsection.php?id=' . $section->id . '&returnurl=' . urlencode($CFG->wwwroot . '/mod/subpage/view.php?id=' . $subpage->get_course_module()->id . '&recache=1&sesskey=' . sesskey()), 'title' => $streditsummary));
$summary .= html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/edit'), 'class' => 'icon edit', 'alt' => $streditsummary));
$summary .= html_writer::end_tag('a');
$summary .= html_writer::empty_tag('br', array());
$summary .= html_writer::start_tag('a', array('href' => $CFG->wwwroot . '/mod/subpage/view.php?id=' . $subpage->get_course_module()->id . '&delete=' . $section->id . '&sesskey=' . sesskey(), 'title' => $strdelete));
if (empty($section->sequence)) {
$summary .= html_writer::empty_tag('img', array('src' => $OUTPUT->pix_url('t/delete'), 'class' => 'icon delete', 'alt' => $strdelete));
}
$summary .= html_writer::end_tag('a');
$summary .= html_writer::empty_tag('br', array());
$summary .= html_writer::empty_tag('br', array());
}
if ($summary !== '') {
$content .= html_writer::tag('div', $summary, array('class' => 'summary'));
}
$content .= $this->render_section($subpage, $modinfo, $section, $editing, $moveitem, $mods, $modnamesused);
if ($editing) {
$content .= print_section_add_menus($subpage->get_course(), $section->section, $modnames, false, true);
if (!empty($CFG->enablecourseajax) and $PAGE->theme->enablecourseajax) {
// hacky way to add list to empty section to allow drag/drop into
// empty sections
$content = str_replace('</div><div class="section_add_menus">', '</div><ul class="section img-text"><li></li></ul>' . '<div class="section_add_menus">', $content);
}
}
//now add returnto links to editing links:
$pattern = '/mod.php\\?[A-Za-z0-9-&;=%:\\/\\-.]+/';
$content = preg_replace_callback($pattern, 'mod_subpage_renderer::subpage_url_regex', $content);
if ($section->stealth) {
$content .= html_writer::end_tag('div');
}
}
$content .= html_writer::end_tag('div');
//end of div class=content
$content .= html_writer::end_tag('li');
}
$content .= html_writer::end_tag('ul');
if ($editing) {
$content .= $this->render_add_button($subpage);
$content .= $this->render_bulkmove_buttons($subpage);
}
return $content;
}
开发者ID:nadavkav,项目名称:moodle-mod_subpage,代码行数:101,代码来源:renderer.php
示例4: print_heading
echo '<td class="content">';
if (!has_capability('moodle/course:viewhiddensections', $context) and !$thissection->visible) {
// Hidden for students
print_heading($weekperiod . ' (' . get_string('notavailable') . ')', null, 3, 'weekdates');
} else {
print_heading($weekperiod, null, 3, 'weekdates');
echo '<div class="summary">';
$summaryformatoptions->noclean = true;
echo format_text($thissection->summary, FORMAT_HTML, $summaryformatoptions);
if (isediting($course->id) && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
echo ' <a title="' . $streditsummary . '" href="editsection.php?id=' . $thissection->id . '">' . '<img src="' . $CFG->pixpath . '/t/edit.gif" class="iconsmall edit" alt="' . $streditsummary . '" /></a><br /><br />';
}
echo '</div>';
print_section($course, $thissection, $mods, $modnamesused);
if (isediting($course->id)) {
print_section_add_menus($course, $section, $modnames);
}
}
echo '</td>';
echo '<td class="right side">';
if ($displaysection == $section) {
echo '<a href="view.php?id=' . $course->id . '&week=0#section-' . $section . '" title="' . $strshowallweeks . '">' . '<img src="' . $CFG->pixpath . '/i/all.gif" class="icon wkall" alt="' . $strshowallweeks . '" /></a><br />';
} else {
$strshowonlyweek = get_string("showonlyweek", "", $section);
echo '<a href="view.php?id=' . $course->id . '&week=' . $section . '" title="' . $strshowonlyweek . '">' . '<img src="' . $CFG->pixpath . '/i/one.gif" class="icon wkone" alt="' . $strshowonlyweek . '" /></a><br />';
}
if (isediting($course->id) && has_capability('moodle/course:update', get_context_instance(CONTEXT_COURSE, $course->id))) {
if ($thissection->visible) {
// Show the hide/show eye
echo '<a href="view.php?id=' . $course->id . '&hide=' . $section . '&sesskey=' . $USER->sesskey . '#section-' . $section . '" title="' . $strweekhide . '">' . '<img src="' . $CFG->pixpath . '/i/hide.gif" class="icon hide" alt="' . $strweekhide . '" /></a><br />';
} else {
开发者ID:JackCanada,项目名称:moodle-hacks,代码行数:31,代码来源:format.php
示例5: print_single_section_page
public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
{
global $PAGE;
$modinfo = get_fast_modinfo($course);
$course = course_get_format($course)->get_course();
// Can we view the section in question?
if (!($sectioninfo = $modinfo->get_section_info($displaysection))) {
// This section doesn't exist
print_error('unknowncoursesection', 'error', null, $course->fullname);
return;
}
if (!$sectioninfo->uservisible) {
if (!$course->hiddensections) {
echo $this->start_section_list();
echo $this->section_hidden($displaysection);
echo $this->end_section_list();
}
// Can't view this section.
return;
}
// Copy activity clipboard..
echo $this->course_activity_clipboard($course, $displaysection);
// General section if non-empty.
$thissection = $sections[0];
//if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
echo $this->start_section_list();
echo $this->section_header($thissection, $course, true, $displaysection);
$this->print_noticeboard($course);
if ($PAGE->user_is_editing() && is_siteadmin($USER)) {
print_section($course, $thissection, $mods, $modnamesused, true, "100%", false, $displaysection);
print_section_add_menus($course, 0, $modnames, false, false, $displaysection);
}
echo $this->section_footer();
echo $this->end_section_list();
//}
// Start single-section div
echo html_writer::start_tag('div', array('class' => 'single-section'));
// The requested section page.
$thissection = $modinfo->get_section_info($displaysection);
// Title with section navigation links.
$sectionnavlinks = $this->get_nav_links($course, $modinfo->get_section_info_all(), $displaysection);
$sectiontitle = '';
$sectiontitle .= html_writer::start_tag('div', array('class' => 'section-navigation header headingblock'));
// Title attributes
$titleattr = 'title';
if (!$thissection->visible) {
$titleattr .= ' dimmed_text';
}
$sectiontitle .= html_writer::tag('div', get_section_name($course, $displaysection), array('class' => $titleattr));
$sectiontitle .= html_writer::end_tag('div');
echo $sectiontitle;
// Now the list of sections..
echo $this->start_section_list();
echo $this->section_header($thissection, $course, true, $displaysection);
// Show completion help icon.
$completioninfo = new completion_info($course);
echo $completioninfo->display_help_icon();
echo $this->courserenderer->course_section_cm_list($course, $thissection, $displaysection);
echo $this->courserenderer->course_section_add_cm_control($course, $displaysection, $displaysection);
echo $this->section_footer();
echo $this->end_section_list();
// Display section bottom navigation.
$sectionbottomnav = '';
$sectionbottomnav .= html_writer::start_tag('nav', array('id' => 'section_footer', 'class' => 'clearfix'));
$sectionbottomnav .= $sectionnavlinks['previous'];
$sectionbottomnav .= $sectionnavlinks['next'];
// $sectionbottomnav .= html_writer::tag('div', $this->section_nav_selection($course, $sections, $displaysection), array('class' => 'mdl-align'));
$sectionbottomnav .= html_writer::end_tag('nav');
echo $sectionbottomnav;
// Close single-section div.
echo html_writer::end_tag('div');
}
开发者ID:noelchavez,项目名称:moodle-theme_elegance,代码行数:72,代码来源:course_format_renderer.php
示例6: print_multiple_section_page
/**
* Output the html for a multiple section page
*
* @param stdClass $course The course entry from DB
* @param array $sections (argument not used)
* @param array $mods (argument not used)
* @param array $modnames (argument not used)
* @param array $modnamesused (argument not used)
*/
public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
{
global $PAGE;
$modinfo = get_fast_modinfo($course);
$course = course_get_format($course)->get_course();
$context = context_course::instance($course->id);
// Title with completion help icon.
$completioninfo = new completion_info($course);
echo $completioninfo->display_help_icon();
echo $this->output->heading($this->page_title(), 2, 'accesshide');
// Copy activity clipboard..
echo $this->course_activity_clipboard($course, 0);
// Now the list of sections..
echo $this->start_section_list();
foreach ($modinfo->get_section_info_all() as $section => $thissection) {
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()) {
echo $this->section_header($thissection, $course, false, 0);
print_section($course, $thissection, null, null, true, "100%", false, 0);
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, 0, null, false, false, 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
$showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && $thissection->showavailability;
if (!$showsection) {
// Hidden section message is overridden by 'unavailable' control
// (showavailability option).
if (!$course->hiddensections && $thissection->available) {
if ($course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
echo $this->section_summary($thissection, $course, $mods);
} else {
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) {
print_section($course, $thissection, null, null, true, "100%", false, 0);
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, $section, null, false, false, 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);
print_section($course, $thissection, null, null, true, "100%", false, 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();
}
}
开发者ID:nrobbins,项目名称:moodle_format_days,代码行数:99,代码来源:renderer.php
示例7: fn_display_category_content
//.........这里部分代码省略.........
$section->course = $course->id;
$section->section = $sectnum;
$section->summary = $category->name;
$section->sequence = '';
$section->visible = 1;
if (!($section->id = insert_record('course_sections', $section))) {
error('Could not create section for category ' . $category->name);
}
}
if (!empty($section) || $isediting) {
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
}
$groupbuttons = $course->groupmode;
$groupbuttonslink = !$course->groupmodeforce;
if ($ismoving) {
$strmovehere = get_string('movehere');
$strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'"));
$strcancel = get_string('cancel');
$stractivityclipboard = $USER->activitycopyname;
}
$modinfo = unserialize($course->modinfo);
$editbuttons = '';
print_simple_box_start("center", "100%", '', 5, "coursebox");
echo '<table class="topics" width="100%">';
echo '<tr id="section-' . $section . '" class="section main">';
echo '<td class="content">';
print_heading_block('<div align="center">' . $category->name . '</div>');
echo '<table class="section" width="100%">';
if (!empty($section) && !empty($section->sequence)) {
$sectionmods = explode(',', $section->sequence);
foreach ($sectionmods as $modnumber) {
if (empty($mods[$modnumber])) {
continue;
}
$mod = $mods[$modnumber];
if ($isediting && !$ismoving) {
if ($groupbuttons) {
if (!($mod->groupmodelink = $groupbuttonslink)) {
$mod->groupmode = $course->groupmode;
}
} else {
$mod->groupmode = false;
}
$editbuttons = '<br />' . make_editing_buttons($mod, true, true);
} else {
$editbuttons = '';
}
if ($mod->visible || $isteacher) {
echo '<tr><td class="activity ' . $mod->modname . '">';
if ($ismoving) {
if ($mod->id == $USER->activitycopy) {
continue;
}
echo '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&sesskey=' . $USER->sesskey . '">' . '<img height="16" width="80" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" border="0" /></a>';
}
$instancename = urldecode($modinfo[$modnumber]->name);
$instancename = format_string($instancename, true, $course->id);
$linkcss = $mod->visible ? '' : ' class="dimmed" ';
if (!empty($modinfo[$modnumber]->extra)) {
$extra = urldecode($modinfo[$modnumber]->extra);
} else {
$extra = '';
}
if (!empty($modinfo[$modnumber]->icon)) {
$icon = $CFG->pixpath . '/' . urldecode($modinfo[$modnumber]->icon);
} else {
$icon = $CFG->modpixpath . '/' . $mod->modname . '/icon.gif';
}
if ($mod->modname == 'label') {
echo format_text($extra, FORMAT_HTML) . $editbuttons;
} else {
echo '<img src="' . $icon . '" height="16" width="16" alt="' . $mod->modfullname . '" /> ' . '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . $instancename . '</a>' . $editbuttons;
}
echo "</td>";
echo "</tr>";
}
}
} else {
echo "<tr><td></td></tr>";
// needed for XHTML compatibility
}
if ($ismoving) {
echo '<tr><td><a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?movetosection=' . $section->id . '&sesskey=' . $USER->sesskey . '">' . '<img height="16" width="80" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" border="0" /></a></td></tr>';
}
if ($isediting && $modnames) {
echo '<tr><td>';
print_section_add_menus($course, $section->section, $modnames, true);
echo '</td></tr>';
}
echo "</table>\n\n";
echo '</td></tr></table>';
print_simple_box_end();
if (empty($courses)) {
print_heading(FN_translate_course_string(get_string("nocoursesyet")));
} else {
foreach ($courses as $course) {
print_course($course);
}
}
}
开发者ID:hmatulis,项目名称:RTL-BIDI-Hebrew-Moodle-Plugins,代码行数:101,代码来源:lib.php
示例8: print_multiple_section_page
/**
* Output the html for a multiple section page
*
* @param stdClass $course The course entry from DB
* @param array $sections The course_sections entries from the DB
* @param array $mods used for print_section()
* @param array $modnames used for print_section()
* @param array $modnamesused used for print_section()
*/
public function print_multiple_section_page($course, $sections, $mods, $modnames, $modnamesused)
{
global $PAGE;
$context = context_course::instance($course->id);
// Title with completion help icon.
$completioninfo = new completion_info($course);
echo $completioninfo->display_help_icon();
echo $this->output->heading($this->page_title(), 2, 'accesshide');
// Copy activity clipboard..
echo $this->course_activity_clipboard($course);
// Now the list of sections..
echo $this->start_section_list();
// General section if non-empty.
$thissection = $sections[0];
unset($sections[0]);
if ($thissection->summary or $thissection->sequence or $PAGE->user_is_editing()) {
echo $this->section_header($thissection, $course, true);
print_section($course, $thissection, $mods, $modnamesused, true);
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, 0, $modnames);
}
echo $this->section_footer();
}
$canviewhidden = has_capability('moodle/course:viewhiddensections', $context);
for ($section = 1; $section <= $course->numsections; $section++) {
if (!empty($sections[$section])) {
$thissection = $sections[$section];
} else {
// This will create a course section if it doesn't exist..
$thissection = get_course_section($section, $course->id);
// The returned section is only a bare database object rather than
// a section_info object - we will need at least the uservisible
// field in it.
$thissection->uservisible = true;
$thissection->availableinfo = null;
$thissection->showavailability = 0;
}
// Show the section if the user is permitted to access it, OR if it's not available
// but showavailability is turned on
$showsection = $thissection->uservisible || $thissection->visible && !$thissection->available && $thissection->showavailability;
if (!$showsection) {
// Hidden section message is overridden by 'unavailable' control
// (showavailability option).
if (!$course->hiddensections && $thissection->available) {
echo $this->section_hidden($section);
}
unset($sections[$section]);
continue;
}
if (!$PAGE->user_is_editing() && $course->coursedisplay == COURSE_DISPLAY_MULTIPAGE) {
// Display section summary only.
echo $this->section_summary($thissection, $course);
} else {
echo $this->section_header($thissection, $course, false);
if ($thissection->uservisible) {
print_section($course, $thissection, $mods, $modnamesused);
if ($PAGE->user_is_editing()) {
print_section_add_menus($course, $section, $modnames);
}
}
echo $this->section_footer();
}
unset($sections[$section]);
}
if ($PAGE->user_is_editing() and has_capability('moodle/course:update', $context)) {
// Print stealth sections if present.
$modinfo = get_fast_modinfo($course);
foreach ($sections as $section => $thissection) {
if (empty($modinfo->sections[$section])) {
continue;
}
echo $this->stealth_section_header($section);
print_section($course, $thissection, $mods, $modnamesused);
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 {
//.........这里部分代码省略.........
开发者ID:nicusX,项目名称:moodle,代码行数:101,代码来源:renderer.php
示例9: get_content
function get_content()
{
global $USER, $CFG;
if ($this->content !== NULL) {
return $this->content;
}
$this->content = new stdClass();
$this->content->items = array();
$this->content->icons = array();
$this->content->footer = '';
if (empty($this->instance)) {
return $this->content;
}
$course = get_record('course', 'id', $this->instance->pageid);
$context = get_context_instance(CONTEXT_COURSE, $course->id);
$isediting = isediting($this->instance->pageid) && has_capability('moodle/course:manageactivities', $context);
$ismoving = ismoving($this->instance->pageid);
$sections = get_all_sections($this->instance->pageid);
if (!empty($sections) && isset($sections[0])) {
$section = $sections[0];
}
if (!empty($section) || $isediting) {
get_all_mods($this->instance->pageid, $mods, $modnames, $modnamesplural, $modnamesused);
}
$groupbuttons = $course->groupmode;
$groupbuttonslink = !$course->groupmodeforce;
if ($ismoving) {
$strmovehere = get_string('movehere');
$strmovefull = strip_tags(get_string('movefull', '', "'{$USER->activitycopyname}'"));
$strcancel = get_string('cancel');
$stractivityclipboard = $USER->activitycopyname;
}
/// Casting $course->modinfo to string prevents one notice when the field is null
$modinfo = unserialize((string) $course->modinfo);
$editbuttons = '';
if ($ismoving) {
$this->content->icons[] = '<img src="' . $CFG->pixpath . '/t/move.gif" class="iconsmall" alt="" />';
$this->content->items[] = $USER->activitycopyname . ' (<a href="' . $CFG->wwwroot . '/course/mod.php?cancelcopy=true&sesskey=' . $USER->sesskey . '">' . $strcancel . '</a>)';
}
if (!empty($section) && !empty($section->sequence)) {
$sectionmods = explode(',', $section->sequence);
foreach ($sectionmods as $modnumber) {
if (empty($mods[$modnumber])) {
continue;
}
$mod = $mods[$modnumber];
if ($isediting && !$ismoving) {
if ($groupbuttons) {
if (!($mod->groupmodelink = $groupbuttonslink)) {
$mod->groupmode = $course->groupmode;
}
} else {
$mod->groupmode = false;
}
$editbuttons = '<div class="buttons">' . make_editing_buttons($mod, true, true) . '</div>';
} else {
$editbuttons = '';
}
if ($mod->visible || has_capability('moodle/course:viewhiddenactivities', $context)) {
if ($ismoving) {
if ($mod->id == $USER->activitycopy) {
continue;
}
$this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?moveto=' . $mod->id . '&sesskey=' . $USER->sesskey . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" /></a>';
$this->content->icons[] = '';
}
$instancename = urldecode($modinfo[$modnumber]->name);
$instancename = format_string($instancename, true, $this->instance->pageid);
$linkcss = $mod->visible ? '' : ' class="dimmed" ';
if (!empty($modinfo[$modnumber]->extra)) {
$extra = urldecode($modinfo[$modnumber]->extra);
} else {
$extra = '';
}
if (!empty($modinfo[$modnumber]->icon)) {
$icon = $CFG->pixpath . '/' . urldecode($modinfo[$modnumber]->icon);
} else {
$icon = $CFG->modpixpath . '/' . $mod->modname . '/icon.gif';
}
if ($mod->modname == 'label') {
$this->content->items[] = format_text($extra, FORMAT_HTML) . $editbuttons;
$this->content->icons[] = '';
} else {
$this->content->items[] = '<a title="' . $mod->modfullname . '" ' . $linkcss . ' ' . $extra . ' href="' . $CFG->wwwroot . '/mod/' . $mod->modname . '/view.php?id=' . $mod->id . '">' . $instancename . '</a>' . $editbuttons;
//Accessibility: incidental image - should be empty Alt text
$this->content->icons[] = '<img src="' . $icon . '" class="icon" alt="" />';
}
}
}
}
if ($ismoving) {
$this->content->items[] = '<a title="' . $strmovefull . '" href="' . $CFG->wwwroot . '/course/mod.php?movetosection=' . $section->id . '&sesskey=' . $USER->sesskey . '">' . '<img style="height:16px; width:80px; border:0px" src="' . $CFG->pixpath . '/movehere.gif" alt="' . $strmovehere . '" /></a>';
$this->content->icons[] = '';
}
if ($isediting && $modnames) {
$this->content->footer = print_section_add_menus($course, 0, $modnames, true, true);
} else {
$this->content->footer = '';
}
return $this->content;
//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:samouk-svn,代码行数:101,代码来源:block_site_main_menu.php
示例10: page_frontpage_settings
/**
* Called from {@link page_print_position()} and it is
* supposed to print the front page settings in the
* center column for the site course and only for
* the default page (EG: the landing page).
*
* @return boolean
**/
function page_frontpage_settings()
{
global $CFG, $SESSION, $SITE, $PAGE, $COURSE;
// Cheap check first - course ID
if ($COURSE->id != SITEID) {
return false;
}
// More expensive check - make sure we are viewing default page
$default = page_get_default_page();
$current = $PAGE->get_formatpage();
if (empty($default->id) or empty($current->id) or $default->id != $current->id) {
return false;
}
$editing = $PAGE->user_is_editing();
/// START COPY/PASTE FROM INDEX.PHP
print_container_start();
/// Print Section
if ($SITE->numsections > 0) {
if (!($section = get_record('course_sections', 'course', $SITE->id, 'section', 1))) {
delete_records('course_sections', 'course', $SITE->id, 'section', 1);
// Just in case
$section->course = $SITE->id;
$section->section = 1;
$section->summary = '';
$section->sequence = '';
$section->visible = 1;
$section->id = insert_record('course_sections', $section);
}
if (!empty($section->sequence) or !empty($section->summary) or $editing) {
print_box_start('generalbox sitetopic');
/// If currently moving a file then show the current clipboard
if (ismoving($SITE->id)) {
$stractivityclipboard = strip_tags(get_string('activityclipboard', '', addslashes($USER->activitycopyname)));
echo '<p><font size="2">';
echo "{$stractivityclipboard} (<a href=\"course/mod.php?cancelcopy=true&sesskey={$USER->sesskey}\">" . get_string('cancel') . '</a>)';
echo '</font></p>';
}
$options = NULL;
$options->noclean = true;
echo format_text($section->summary, FORMAT_HTML, $options);
if ($editing) {
$streditsummary = get_string('editsummary');
echo "<a title=\"{$streditsummary}\" " . " href=\"course/editsection.php?id={$section->id}\"><img src=\"{$CFG->pixpath}/t/edit.gif\" " . " class=\"iconsmall\" alt=\"{$streditsummary}\" /></a><br /><br />";
}
get_all_mods($SITE->id, $mods, $modnames, $modnamesplural, $modnamesused);
print_section($SITE, $section, $mods, $modnamesused, true);
if ($editing) {
print_section_add_menus($SITE, $section->section, $modnames);
}
print_box_end();
}
}
if (isloggedin() and !isguest() and isset($CFG->frontpageloggedin)) {
$frontpagelayout = $CFG->frontpageloggedin;
} else {
$frontpagelayout = $CFG->frontpage;
}
foreach (explode(',', $frontpagelayout) as $v) {
switch ($v) {
/// Display the main part of the front page.
case FRONTPAGENEWS:
if ($SITE->newsitems) {
// Print forums only when needed
require_once $CFG->dirroot . '/mod/forum/lib.php';
if (!($newsforum = forum_get_course_forum($SITE->id, 'news'))) {
error('Could not find or create a main news forum for the site');
}
if (!empty($USER->id)) {
$SESSION->fromdiscussion = $CFG->wwwroot;
if (forum_is_subscribed($USER->id, $newsforum)) {
$subtext = get_string('unsubscribe', 'forum');
} else {
$subtext = get_string('subscribe', 'forum');
}
print_heading_block($newsforum->name);
echo '<div class="subscribelink"><a href="mod/forum/subscribe.php?id=' . $newsforum->id . '">' . $subtext . '</a></div>';
} else {
print_heading_block($newsforum->name);
}
forum_print_latest_discussions($SITE, $newsforum, $SITE->newsitems, 'plain', 'p.modified DESC');
}
break;
case FRONTPAGECOURSELIST:
if (isloggedin() and !has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() and empty($CFG->disablemycourses)) {
print_heading_block(get_string('mycourses'));
print_my_moodle();
} else {
if (!has_capability('moodle/site:config', get_context_instance(CONTEXT_SYSTEM)) and !isguest() or count_records('course') <= FRONTPAGE
|
请发表评论