Posts made by Itamar Tzadok

I use javascript to create the import text in Moodle XML which I then copy to a text file and import to the question bank. The javascript goes into the javascript template and there are buttons in the list and single view which generate the code and display it in a popup windown from which it can be copied. Hope this helps. smile

First you zip the files you want to upload, upload and unzip. You should have in the database a text field for the file name, say, fileName. Now you prepare a csv file with the list of the file names of the files you uploaded. For example:

fileName
file1.doc
file2.doc
file3.xls

You import the csv file into the database. Then you add to the single or list view template or both, an a tag with the file path and the file name.

For example, suppose your files location in your Moodle files is:

http://your.moodle.org/moodle/file.php/3/docs/

You can add to the template the following html:

<a href="http://your.moodle.org/moodle/file.php/3/docs/||fileName||">||fileName||</a>

(|| stands for square brackets) and the link to the file should be displayed.

You can also associate the link with a doc type image. So you add to the database another field (text or menu) for the file type. You add the relevant info to the csv:

fileName,fileType
file1.doc,doc
file2.doc,doc
file3.xls,xls

Then you lookup the url of your moodle doctype pix and add to the html an img tag such as

<img href="http://your.moodle.org/moodle/pix/f/||fileType||.gif" />

and if you used the same names for the file types as used by moodle it should show the proper file type image (e.g. pdf.gif for pdf)


Hope this helps smile
Width is usually only a recommendation especially as an upper boundary. Try setting the width of the middle column to 100%. This should prevent the side columns from expanding (although it is not really their fault but the browser's that renders them wink). At any rate you will have to keep the content of the side blocks within range or else the side will expand.

Hope this helps.

smile
This time I'd like to introduce a simple bar-graph poll. The database has one radio field with the choices. It is set to required entries: 1, Entries required before viewing:1, Maximum entries:1, so that the user/student has to vote before viewing the results. The single view is effectively disabled by redirecting the page to the list view. The list view displays a bar-graph of the results. I'd like to make the code just a little bit more generic and then I'll add the preset to Moodle Exchange. In the meantime see image below and comments and suggestions are welcome. smile

Other things you can do with a database if you only find a good enough reason to do them:
Attachment data-bargraphpoll-listview.png
Average of ratings: -