本文整理匯總了PHP中print_section函數的典型用法代碼示例。如果您正苦於以下問題:PHP print_section函數的具體用法?PHP print_section怎麽用?PHP print_section使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了print_section函數的13個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: print_heading
echo '<td class="left side"> ' . $currenttext . '</td>';
$weekperiod = $weekday . ' - ' . $endweekday;
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
示例2: strip_tags
/// 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:
示例3: 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();
}
}
示例4: render_section
/**
* Render single section
*
* @param
* @return
*/
protected function render_section($subpage, $modinfo, $section, $editing, $moveitem, $mods, $modnamesused)
{
global $CFG;
ob_start();
print_section($subpage->get_course(), $section, $mods, $modnamesused, true);
$content = ob_get_contents();
ob_end_clean();
//end buffering.
$content = str_replace($CFG->wwwroot . '/course/mod.php?copy', 'view.php?id=' . $subpage->get_course_module()->id . '&copy', $content);
$content = str_replace("'togglecompletion.php'", "'" . $CFG->wwwroot . "/course/togglecompletion.php'", $content);
$findcontent = "<input type='hidden' name='completionstate'";
$content = str_replace($findcontent, "<input type='hidden' name='backto' value='" . $CFG->wwwroot . '/mod/subpage/view.php?id=' . $subpage->get_course_module()->id . "'/>" . $findcontent, $content);
return $content;
}
示例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');
}
示例6: print_single_section_page
/**
* Output the html for a single 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)
* @param int $displaysection The section number in the course which is being displayed
*/
public function print_single_section_page($course, $sections, $mods, $modnames, $modnamesused, $displaysection)
{
global $PAGE, $SESSION, $DB;
$updateposition = get_string('updateposition', 'format_gps');
$modaldiv = html_writer::div($updateposition, 'updateposition hide', array('id' => 'updatepositionclick'));
echo $modaldiv;
// Module form with map.
$viewcourse = new moodle_url('/course/view.php', array('id' => $course->id));
$updatecourseviewlink = html_writer::empty_tag('br') . html_writer::link($viewcourse, get_string('updatepage', 'format_gps'), array('class' => 'gps-continue'));
$map = html_writer::div('', 'googlemap', array('id' => 'map'));
$mapcontainer = html_writer::div($map, 'mapcontainer', array('id' => 'mapcontainer'));
$modalform = html_writer::div($mapcontainer . $updatecourseviewlink, 'popupgeo', array('id' => 'popupgeo'));
echo $modalform;
$modinfo = get_fast_modinfo($course);
$course = course_get_format($course)->get_course();
$thissection = $modinfo->get_section_info($displaysection);
// 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;
}
$location = $this->gps_get_user_location();
// Check geo location is within limits.
$proximity = new stdClass();
if ($geotopic = $DB->get_record('format_gps', array("courseid" => $course->id, "section" => $section))) {
if ($location) {
$proximity = format_gps_check_proximity($thissection, $location);
} else {
$proximity->status = 'notallowed';
}
} else {
$proximity->status = 'ok';
}
if ($proximity->status == 'toofar') {
$sectioninfo->uservisible = false;
}
if (!$sectioninfo->uservisible) {
if (!$course->hiddensections) {
echo $this->start_section_list();
if ($proximity->status == 'toofar') {
echo $this->gps_section_hidden($displaysection);
} else {
if ($proximity->status == 'notallowed') {
echo $this->gps_section_notallowed($displaysection);
} else {
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);
if ($thissection->summary or !empty($modinfo->sections[0]) or $PAGE->user_is_editing()) {
echo $this->start_section_list();
echo $this->section_header($thissection, $course, true, $displaysection);
$courserenderer = $PAGE->get_renderer('core', 'course');
print_section($course, $thissection, null, null, true, "100%", false, $displaysection);
if ($PAGE->user_is_editing()) {
echo $courserenderer->course_section_add_cm_control($course, 0, $displaysection);
}
echo $this->section_footer();
echo $this->end_section_list();
}
// Start single-section div.
echo html_writer::start_tag('div', array('class' => 'single-section'));
// 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'));
$sectiontitle .= html_writer::tag('span', $sectionnavlinks['previous'], array('class' => 'mdl-left'));
$sectiontitle .= html_writer::tag('span', $sectionnavlinks['next'], array('class' => 'mdl-right'));
// Title attributes.
$titleattr = 'mdl-align 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();
$courserenderer = $PAGE->get_renderer('core', 'course');
//.........這裏部分代碼省略.........
示例7: cms_get_section
/**
* Get section data. This is an alias function to print_section
*
* @see print_section()
*/
function cms_get_section($course, $thissection, $mods, $modnamesused)
{
ob_start();
print_section($course, $thissection, $mods, $modnamesused, true);
$content = ob_get_contents();
ob_end_clean();
return $content;
}
示例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 {
//.........這裏部分代碼省略.........
示例9: 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') <= FRONTPAGECOURSELIMIT) {
// admin should not see list of courses when there are too many of them
print_heading_block(get_string('availablecourses'));
print_courses(0);
}
//.........這裏部分代碼省略.........
示例10: print_section
/**
* If used, this will just call the library function (for now). Replace this with your own to make it
* do what you want.
*
*/
function print_section($course, $section, $mods, $modnamesused, $absolute = false, $width = "100%", $return = false)
{
if ($return) {
ob_start();
}
print_section($course, $section, $mods, $modnamesused, $absolute, $width);
if ($return) {
$output = ob_get_contents();
ob_end_clean();
return $output;
} else {
return '';
}
}
示例11: _make_block_topics
function _make_block_topics()
{
global $OUTPUT, $course, $sections, $editing, $has_cap_update, $has_cap_vishidsect, $mods, $modnames, $modnamesused, $str_edit_summary, $url_pic_edit;
$summaryformatoptions = new stdClass();
$summaryformatoptions->noclean = true;
$summaryformatoptions->overflowdiv = true;
$str_hidden_topic = get_string('hidden_topic', 'format_grid');
if ($editing && $has_cap_update) {
$str_move_up = get_string('moveup');
$str_move_down = get_string('movedown');
$str_topic_hide = get_string('hidefromothers', 'format_grid');
$str_topic_show = get_string('showfromothers', 'format_grid');
$url_pic_move_up = $OUTPUT->pix_url('t/up');
$url_pic_move_down = $OUTPUT->pix_url('t/down');
$url_pic_topic_hide = $OUTPUT->pix_url('i/hide');
$url_pic_topic_show = $OUTPUT->pix_url('i/show');
}
for ($section = 1; $section <= $course->numsections; $section++) {
if (empty($sections[$section])) {
//Section should have been created in the icons section above. If it's empty then its an error.
throw new coding_exception('Error, section ' . $section . ' not found!');
}
$thissection = $sections[$section];
if (!$has_cap_vishidsect && !$thissection->visible && $course->hiddensections) {
continue;
}
$sectionstyle = 'section main';
if (!$thissection->visible) {
$sectionstyle .= ' hidden';
}
$sectionstyle .= ' grid_section';
echo html_writer::start_tag('li', array('id' => 'section-' . $section, 'class' => $sectionstyle));
// Note, 'right side' is BEFORE content.
echo html_writer::tag('div', ' ', array('class' => 'left side'));
echo html_writer::start_tag('div', array('class' => 'right side'));
if ($editing && $has_cap_update) {
// Show the hide/show eye
if ($thissection->visible) {
$op_topic_visible = 'hide';
$str_topic_visible_text = $str_topic_hide;
$url_pic_topic_visible = $url_pic_topic_hide;
} else {
$op_topic_visible = 'show';
$str_topic_visible_text = $str_topic_show;
$url_pic_topic_visible = $url_pic_topic_show;
}
echo html_writer::link(new moodle_url('/course/view.php#section-' . $section, array('id' => $course->id, $op_topic_visible => $section, 'sesskey' => sesskey())), html_writer::empty_tag('img', array('src' => $url_pic_topic_visible, 'class' => 'icon ' . $op_topic_visible, 'alt' => $str_topic_visible_text)), array('title' => $str_topic_visible_text, 'class' => 'editing_showhide'));
// Add a arrow to move section up
if ($section > 1) {
echo _move_section_arrow($section, $course, -1, 'up', $str_move_up, $url_pic_move_up, 'moveup');
}
// Add a arrow to move section down
if ($section < $course->numsections) {
echo _move_section_arrow($section, $course, -1, 'down', $str_move_down, $url_pic_move_down, 'movedown');
}
}
echo html_writer::end_tag('div');
echo html_writer::start_tag('div', array('class' => 'content'));
if ($has_cap_vishidsect || $thissection->visible) {
//if visible
if (!empty($thissection->name)) {
echo format_text($OUTPUT->heading($thissection->name, 3, 'sectionname'), FORMAT_HTML);
}
echo html_writer::start_tag('div', array('class' => 'summary'));
$coursecontext = get_context_instance(CONTEXT_COURSE, $course->id);
$summarytext = file_rewrite_pluginfile_urls($thissection->summary, 'pluginfile.php', $coursecontext->id, 'course', 'section', $thissection->id);
echo format_text($summarytext, FORMAT_HTML, $summaryformatoptions);
if ($editing && $has_cap_update) {
echo html_writer::link(new moodle_url('editsection.php', array('id' => $thissection->id)), html_writer::empty_tag('img', array('src' => $url_pic_edit, 'alt' => $str_edit_summary, 'class' => 'icon edit')), array('title' => $str_edit_summary));
}
echo html_writer::end_tag('div');
print_section($course, $thissection, $mods, $modnamesused);
if ($editing) {
print_section_add_menus($course, $section, $modnames);
}
} else {
$str_title = _get_title($thissection->summary);
echo html_writer::tag('h2', $str_title);
echo html_writer::tag('p', $str_hidden_topic);
}
echo html_writer::end_tag('div');
echo html_writer::end_tag('li');
}
}
示例12: print_section
if ($mime->has_type($check)) {
echo 'Got ', $check, "\n";
} else {
echo "{$check} now gone :(", "\n";
}
if ($mime->has_type($check2)) {
echo 'Got ', $check2, "\n";
} else {
echo "{$check2} now gone :(", "\n";
}
if ($mime->has_type($check3)) {
echo 'Got ', $check3, "\n";
} else {
echo "{$check3} now gone :(";
}
print_section('Remove all');
$ext = 'pdf';
if ($mime->has_extension($ext)) {
echo "Got {$ext}";
} else {
echo "No {$ext}";
}
echo "\n";
$mime->remove_type();
if ($mime->has_extension($ext)) {
echo "Got {$ext}";
} else {
echo "No {$ext}";
}
echo '</pre>';
function print_section($desc = '')
示例13: optional_param
require_once '../../../config.php';
require_once '../../lib.php';
$topic = optional_param('topic', -1, PARAM_INT);
$courseid = optional_param('courseid', 0, PARAM_INT);
if (!($course = get_record('course', 'id', $courseid))) {
error('Invalid course id');
}
//add_to_log($course->id, 'course', 'view', "view.php?id=$course->id", "$course->id");
$context = get_context_instance(CONTEXT_COURSE, $course->id);
if (!($section1 = get_record('course_sections', 'course', $course->id, 'section', $topic))) {
error('Invalid topic number');
}
if (!($section2 = get_record('course_sections', 'course', $course->id, 'section', (int) ($topic + 1)))) {
error('Invalid topic number');
}
get_all_mods($course->id, $mods, $modnames, $modnamesplural, $modnamesused);
// echo '<tr id="section-'.$section->id.'" class="section main">';
// echo '<td class="left side"> </td>';
// echo '<td class="content">';
echo '<table id="tbookpages"><tbody><tr>';
echo '<td>';
print_section($course, $section1, $mods, $modnamesused);
echo '</td>';
echo '<td>';
print_section($course, $section2, $mods, $modnamesused);
echo '</td>';
echo '</tr></tbody></table>';
// echo '</td>';
// echo '<td class="right side"> </td>';
// echo '</tr>';
// echo '<tr class="section separator"><td colspan="3" class="spacer"></td></tr>';