By:
- making a slight addition to the HTMLarea file,
- adding a new language string, and
- a using the :before pseudo element in my css sheet
3 Steps:
STEP 1: add a few lines to your HTMLarea file : "\lib\editor\htmlarea.php"
this.formatblock = {
"":"",
"<?php echo $strheading ?> 1": "h1",
"<?php echo $strheading ?> 2": "h2",
"<?php echo $strheading ?> 3": "h3",
"<?php echo $strheading ?> 4": "h4",
"<?php echo $strheading ?> 5": "h5",
"<?php echo $strheading ?> 6": "h6",
"<?php echo $strnormal ?>": "p",
"<?php echo $straddress ?>": "address",
"<?php echo $strpreformatted ?>": "pre"
Add a new echo line with a new string name:
(e.g. "<?php echo $strcorrect ?>": "span class='correct'", )
You can use whatever html language you like for the second half of the call, I chose 'span' because it's more flexible with it's line spacing than 'div'. 'ID' could also be substituted no problem, it's up to you. Naturally, you'll just need to make sure that you're naming it correctly in your css file.
(Also make sure to add a comma at the end of the previous line)
Then around line 29 you'll see:
$strheading = get_string("heading", "editor");
$strnormal = get_string("normal", "editor");
$straddress = get_string("address", "editor");
$strpreformatted = get_string("preformatted", "editor");
This tells the file where to identify the language string.
Create a new language string call that corresponds with your echo
$strcorrect = get_string("correct", "editor");
STEP 2: In your language file add a new string
$string['correct'] = 'Correct';
STEP 3: In your css file make the style you wish to see.
It can be anything. I wanted my faculty to be able to have a unified look for the lesson module for correct and incorrect answers so I created a small gif and used the :before pseudo-element to get this result: (see attached).
here is my css code
font: italic bold 18pt "Tahoma", "sans-serif";
color: lime;
}
span.right:before {
content: url(www.rootfolder///checkmark.gif);
display: inline;
}
span.wrong {
font: italic bold 18pt "Tahoma", "sans-serif";
color: maroon;
}
span.wrong:before {
content: url(www.rootfolder///wrong.gif);
display: inline;
}
I put the graphics in the root moodle pix folder and put the whole line there so that the css would work no matter which class the lesson is in.
I'm thrilled about this and I'm sure I'll find much more styles to add in the near future. It helps keep a good style throughout the site, and keeps my faculty from having to spend precious hours on things that they shouldn't have to know how to do (and spend more time with students instead).
~mc~