Course contents block: Difference between revisions

From MoodleDocs
m (→‎Installation: The block development moved to git, instructions fixed)
m (Text replacement - "class="nicetable"" to "class="wikitable"")
 
(4 intermediate revisions by 2 users not shown)
Line 1: Line 1:
'''Course contents block''' is similar to the [http://moodle.org/mod/data/view.php?rid=949 Simple navigation block]. It simply produces a list of all visible topic/week in your course. Clicking at one of these links will display that particular week or topic.
'''Course contents block''' produces a table of contents for the course - ie a list of all visible topics/weeks in your course. Clicking at one of these links will display that particular section (topic or week).


The block automatically extracts a suitable title for every week or topic from the section summary. If you start summary with a heading (H1, H2, H3, etc), it will use such heading text. If your summary starts with a bold text, it will be used as a section title. If the summary consists of several paragraphs, the first one will be used. If the summary is empty, a customizable text "Unit X" (where X is the number) is displayed. Technically spoken, the plain text content of the first non-empty HTML DOM node from the section summary is used as the summary title.
If the section has its name defined, the block uses it as the title for that section.


The block has been written and is currently maintained by [[User:David Mudrak|David Mudrak]]
If the section name is not defined but there is the section summary (description) available, the block automatically extracts a suitable title from that summary. If you start summary with a heading (H1, H2, H3, etc), it will use such heading text. If your summary starts with a bold text, it will be used as a section title. If the summary consists of several paragraphs, the first one will be used.  Technically spoken, the plain text content of the first non-empty HTML DOM node from the section summary is used as the summary title.
 
If the summary is empty, a customizable text "Unit X" (where X is the number) is displayed.
 
You can combine this feature with the multi-language filter to generate course contents in the user's language.
 
The block was written and is currently maintained by [[User:David Mudrak|David Mudrak]]


[[Image:course-contents-block-screenshot.png|thumb|The topic title is automatically extracted from the section summary|400px|left]]
[[Image:course-contents-block-screenshot.png|thumb|The topic title is automatically extracted from the section summary|400px|left]]
Line 10: Line 16:
==Installation==
==Installation==


There is a public source code repository for the block at [https://github.com/mudrd8mz/moodle-block_course_contents]. You can either clone that repository or just download the latest package there. Follow the instructions provided by github for details but this may be what you want:
There is a public source code repository for the block at [https://github.com/mudrd8mz/moodle-block_course_contents github.com]. You can either clone that repository or just download the latest package there. Follow the instructions provided by Github or see [[Git for Administrators]] for details. This may be what you want:


  # cd /var/www/moodlesite/htdocs/blocks
  # cd /var/www/moodlesite/htdocs/blocks
  # git clone git://github.com/mudrd8mz/moodle-block_course_contents.git course_contents
  # git clone git://github.com/mudrd8mz/moodle-block_course_contents.git course_contents
# cd course_contents
# git checkout -b local_22_STABLE origin/MOODLE_22_STABLE


If your Moodle dirroot is git checkout too, you may want to add the block directory into the list of ignored files:
If your Moodle dirroot is git checkout too, you may want to add the block directory into the list of ignored files:
Line 19: Line 27:
  # cd /var/www/moodlesite/htdocs
  # cd /var/www/moodlesite/htdocs
  # echo /blocks/course_contents/ >> .git/info/exclude
  # echo /blocks/course_contents/ >> .git/info/exclude
To download the block in ZIP or TAR.GZ packages, follow [https://github.com/mudrd8mz/moodle-block_course_contents/tags this page]


==Examples==
==Examples==


{| class="nicetable"
{| class="wikitable"
! <center>Start of the section summary HTML</center>
! <center>Start of the section summary HTML</center>
! <center>Automatic course contents line</center>
! <center>Automatic course contents line</center>
Line 42: Line 52:
==See also==
==See also==


* [http://moodle.org/mod/data/view.php?d=13&rid=2156 Modules and plugins database record]
* [http://moodle.org/plugins/pluginversions.php?plugin=block_course_contents Plugins database record]


[[Category:Block]]
[[Category:Block]]
[[Category:Contributed code]]
[[Category:Contributed code]]
[[es:Bloque de contenidos del curso]]

Latest revision as of 15:14, 10 August 2021

Course contents block produces a table of contents for the course - ie a list of all visible topics/weeks in your course. Clicking at one of these links will display that particular section (topic or week).

If the section has its name defined, the block uses it as the title for that section.

If the section name is not defined but there is the section summary (description) available, the block automatically extracts a suitable title from that summary. If you start summary with a heading (H1, H2, H3, etc), it will use such heading text. If your summary starts with a bold text, it will be used as a section title. If the summary consists of several paragraphs, the first one will be used. Technically spoken, the plain text content of the first non-empty HTML DOM node from the section summary is used as the summary title.

If the summary is empty, a customizable text "Unit X" (where X is the number) is displayed.

You can combine this feature with the multi-language filter to generate course contents in the user's language.

The block was written and is currently maintained by David Mudrak

The topic title is automatically extracted from the section summary


Installation

There is a public source code repository for the block at github.com. You can either clone that repository or just download the latest package there. Follow the instructions provided by Github or see Git for Administrators for details. This may be what you want:

# cd /var/www/moodlesite/htdocs/blocks
# git clone git://github.com/mudrd8mz/moodle-block_course_contents.git course_contents
# cd course_contents
# git checkout -b local_22_STABLE origin/MOODLE_22_STABLE

If your Moodle dirroot is git checkout too, you may want to add the block directory into the list of ignored files:

# cd /var/www/moodlesite/htdocs
# echo /blocks/course_contents/ >> .git/info/exclude

To download the block in ZIP or TAR.GZ packages, follow this page

Examples

Start of the section summary HTML
Automatic course contents line
Welcome!<br />In this course, you will ... Welcome!
<h1>Introduction</h1><p>In this course ...</p> Introduction
<h1><span>Lesson 1</span>: Introduction</h1> Lesson 1

See also